Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Question on creating new functions

Featured Replies

So, I've been playing with LINDA and have a question about whether its reasonably easy to create a new functions. I read the manual about the hunt mode, but I'm trying to figure out what I can do with that info.For instance, in the NGX, if I flip one of the Hydro pumps and it says "Button 176 (or something like that). How do I use knowing that Eng Hyd Pump 1 is "Button 176" to map something to that function? The manual tells you how to figure out what the function is, but not how to use it, so thoughts on this would be helpful.

PMDGAirbus.gif

Doug Orvis

PP-ASEL-IA (USA), Based at KHEF

 

Picture courtesy of Kyle Rodgers

I saw a huge list of NGX commandsso, prob pumps are defined in latest NGX module (1.3 is latest, i think)

Intel 2500K | AMD 7970 | Win7x64 | 16GB | TV 40" | Touchscreen 22" | HOTAS | Rudder | MCP | FFB Joystick | FSX-SE | Prepar3D | DSC A10

Hi "realsimpilot",hope I understood your question right...the answer is not easy as there is no "do it so and so and you get this and this"Every addon behaves in an other way.So, A2A uses clear structured LVars (for nearly everything) so it relative easy: move a switch and you see a LVar for your functionOther way is PMDG: they use control numbers for systems and LVars for just moving the knobs.Other developers have extra Lvars or control numbers for just the knob sounds.Here a a good thread which explain a lot from the ground uphttp://forum.avsim.net/topic/350724-flight1-cessna-mustang-new-profile-request/

Guenter Steiner
--------------------------------------------------------------------------------------

Betatester for: A2A, LORBY, FSR-Pillow Tester
--------------------------------------------------------------------------------------

  • Author

Guenter, thanks. Yes that's what I wanted to know. But, it might be more complicated than I wanted to now.Yes, the issue is that NGX module 1.3 doesn't contain overhead functions like Hyd panel. So, I was thinking they could be added to the script.For instance, the NGX module contains this for one of the six fuel pumps (and there's five others)function NGX_PUMP1_AFT_on () if ipc.readLvar('ngx_switch_37_a') == 0 then ipc.control(69669, 536870912) end DspShow("PMP1", "A on")endfunction NGX_PUMP1_AFT_off () if ipc.readLvar('ngx_switch_37_a') == 100 then ipc.control(69669, 536870912) end DspShow("PMP1", "Aoff")endSo, if I could identify the LVAR and the switch, then I could just replace the numbers in this script, change the labels and make it work too, no? So, for instance, assume it was switch X and ipc.control Y and Z, then I coud say, add this to the script:function HYD_ELEC_A_on () [i MADE THIS UP AS A TITLE] if ipc.readLvar('ngx_switch_X_a') == 0 then ipc.control(Y, Z) end DspShow("PMP1", "A on") [NOT SURE WHAT DO HERE.]endfunction HYD_ELEC_A_off () if ipc.readLvar('ngx_switch_X_a') == 100 then ipc.control(Y, Z) end DspShow("PMP1", "Aoff") [AGAIN, NOT SURE]endSo, that's what I have in mind, and will peruse the other thread too.

PMDGAirbus.gif

Doug Orvis

PP-ASEL-IA (USA), Based at KHEF

 

Picture courtesy of Kyle Rodgers

Ah ok, now I understand!Indeed, hydraulic pumps are not implemented, right!(simply as I have no free hardwareswitch for them Whistle.gif )As I understand you right, you will learn a bit about LUA and LINDA tracer, so I avoid to present you just the ready functions. Instead I help you to create the function by yourself, ok?- start LINDA tracer and console and expand console. check "LUA events" and "FSX control"- click on the hydr switches and you will see for ENG1 Control: 69797 - 536870912for ELEC2Control: 69799 - 536870912for ELEC1Control: 69800 - 536870912for ENG2Control: 69798 - 536870912these controls just toggle the switches!Now, we are lucky to get the switch position with LUA variables- LINDA tracer; "reload LVars list" to get all NGX variables listed. - click start all and wait a few seconds- now move the switch and you'll get as example for Hydraulic ENG1LVar: ngx_switch_165_a = 0 and LVar: ngx_switch_165_a = 100That is our wanted Lvar for this switch.Now, have a look at similar functions like fuel pumps:we say now for ON:"just toggle the switch, when the switch is in position off"meansif ipc.readLvar("ngx_switch_165_a = 0) then ...I think, you are now able to make your own function!Now you have to search the LVars for the other switches, of courseAnd for the DspShow:you can type in here whatever you want!So, your suggestion above is absolutely correct.Maybe you think about how to make it a bit better:"HPmp", "A1on" and "A1of" ... I don't know, that is really not easy.Maybe you find a better shortening or leave your auggestion as it is ...If have tested your function thourogly, we are glad to implement it in version 2.0many thanks!

Guenter Steiner
--------------------------------------------------------------------------------------

Betatester for: A2A, LORBY, FSR-Pillow Tester
--------------------------------------------------------------------------------------

  • Author

Thanks. I will give that a whirl. I got the first part (the switch numbers), but haven't gotten the other numbers yet. I will this method when I have some spare moments. More importantly, though, you confirmed the best part, that if a function isn't in the script, it likely can be added, at least for main systems like Hyd.

PMDGAirbus.gif

Doug Orvis

PP-ASEL-IA (USA), Based at KHEF

 

Picture courtesy of Kyle Rodgers

Yes, of course, you can add anything you like!Combine it, merge it, improve it ... it must work in the end!

Guenter Steiner
--------------------------------------------------------------------------------------

Betatester for: A2A, LORBY, FSR-Pillow Tester
--------------------------------------------------------------------------------------

  • Author

Ok, thanks. I was able to play around with tracer tonight for half an hour and have a question. If I hover over a switch, I'll get a reading line "Control 69800 - 4417472" (that's not the number, just an example.) If I click on it to move it up or down, then that's when I get 69800 - 536870912 as you pointed out. Is there a significance to that first number when you're just hovering over it?

PMDGAirbus.gif

Doug Orvis

PP-ASEL-IA (USA), Based at KHEF

 

Picture courtesy of Kyle Rodgers

I think so ... the important number is in every case the control number, the 69800!I think hovering and clicking will give the same number - I just click anyway to be 100% sure.Other case with the second numbers:you will find also here 536870912, or -2147483648 or some other numbers.We have also mixed them in the script as I initially thought these are for on and off.I can't say it for 100% today, but I think it is in any case just a toggler, both number will switch on and off.But you have to try it.

Guenter Steiner
--------------------------------------------------------------------------------------

Betatester for: A2A, LORBY, FSR-Pillow Tester
--------------------------------------------------------------------------------------

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.