rozelc Posted September 21, 2021 Report Posted September 21, 2021 Hi All, I’m trying to use the lua example TrippleUse.lua without much success. I’m presently using a push button and steering switch to change between Nav radio 1 and 2 or Com radio 1 and 2. And 2 more buttons to swap the frequencies of the active Nav or Com radios. When using TrippleUse.lua I get unpredictable results. 200=CP(-C,29)C,16,C33290,0 -{:MobiFlight.AS1000_MFD_NAV_Push}- 201=CP(+C,29)C,16,C33297,0 -{:MobiFlight.AS1000_MFD_COM_Push}- 121=PC,38,C33285,0 -{:MobiFlight.AS1000_MFD_NAV_Switch}- 122=PC,34,C33292,0 -{:MobiFlight.AS1000_MFD_COM_Switch}- I was hoping to use a button with a long press to do the Push and a short press to do the Switch. Thanks for looking.
John Dowson Posted September 22, 2021 Report Posted September 22, 2021 13 hours ago, rozelc said: When using TrippleUse.lua I get unpredictable results. 200=CP(-C,29)C,16,C33290,0 -{:MobiFlight.AS1000_MFD_NAV_Push}- 201=CP(+C,29)C,16,C33297,0 -{:MobiFlight.AS1000_MFD_COM_Push}- 121=PC,38,C33285,0 -{:MobiFlight.AS1000_MFD_NAV_Switch}- 122=PC,34,C33292,0 -{:MobiFlight.AS1000_MFD_COM_Switch}- What has this got to do with the Tripleuse.lua? To use that, simply change the joy and btn variables in the script, as well as the control numbers you wish to use for the single, double and long press. And to see what is happening if you have issues, enable lua debug logging (as well as events) and take a look at the log. 13 hours ago, rozelc said: I’m presently using a push button and steering switch to change between Nav radio 1 and 2 or Com radio 1 and 2. And 2 more buttons to swap the frequencies of the active Nav or Com radios. And so what has this got to do with the TripplrUse.lua? That is for three actions on the same button (hence triple use!). The assignments you posted are compound assignments to button 16 which depend on the state if button 29, and standard assignments to buttons 34 and 38. What isn't working with that? Try logging buttons & keys as well as events to see what is happening. Note that if button 29 is not a switch or sticky button (i.e. it sends a press followed by a release directly) then maybe the button is always unpressed so you only get the one action. If this is the case, you should use a flag condition instead (see P21 of Advanced user guide). But logging should tell you what is happening.
rozelc Posted September 22, 2021 Author Report Posted September 22, 2021 Hi John, Thanks for the response. And thanks to FSUIPC7 I can in the 172 G1000nxi ver.6 I can take off from KRFD rwy 25 climb to 4000’ using the autopilot fly the RNAVgps25 and land with only using mouse to activate VNV. Nothing to do with tripleuse.lua. That being said I see including this chunk of my fsuipc.ini was not helpful. Here is the modified tripleuse.lua, zelTripleUse.lua and the debug log. The log includes a long press 4 seconds, a short press and a double press. I think I’m missing something important in my fsuipc setup is missing as nothing happens in the sim when I press the key to activate the lua file. Thanks again. Rozel zelTripleUse.lua FSUIPC7.log
John Dowson Posted September 22, 2021 Report Posted September 22, 2021 You need to start the TrippleUseLia (or, in your case, zelTripleUse.lua) from the [Auto] section of your FSUIPC7.ini - see the Advanced User guide if you don't know how to do this. It will then run when you start a flight and handle the button presses. Looks like you are starting it on a button press, which is not really applicable to this type of lua - it should be running all the time. So please try that first. If you still have issues, can you please show me a full FSUIPC7.log file, not a continuation log, and also attach your FSUIPC7.ini. John
rozelc Posted September 22, 2021 Author Report Posted September 22, 2021 Hi John, *********************Success *********************** I added [Auto] 1=zelTripleUse and nothing happened. And then I added a button to run 1037=PE,13,CL4:D,0 -{LuaDebug zelTripleUse}- Now all is working. I don’t understand the need for -{LuaDebug zelTripleUse}-. Is there something in the “FSUIPC7 for Advanced User’s manual I should be reading? Lots of information there but for me it's like trying "to get a drink of water from a fire hose". FSUIPC7.ini
Pete Dowson Posted September 22, 2021 Report Posted September 22, 2021 1 hour ago, rozelc said: I added [Auto] 1=zelTripleUse and nothing happened. This is because you haven't actually told FSUIPC what to do. The [Auto] section is for commands or controls for FSUIPC to obey. The line should have been: 1=Lua zelTripleUse "Lua" being the documented command or control to run a plug-in (as listed for assignment). 1 hour ago, rozelc said: And then I added a button to run 1037=PE,13,CL4:D,0 -{LuaDebug zelTripleUse}- Now all is working. You don't really want to use "LuaDebug". Just the standard Lua command is fine. You are just wasting resources and filling the log up with debugging information. 1 hour ago, rozelc said: I don’t understand the need for -{LuaDebug zelTripleUse}-. The part between the -{ and }- is just annotation to help understand the assignments. 1 hour ago, rozelc said: Is there something in the “FSUIPC7 for Advanced User’s manual I should be reading? No, the use of the Lua commands is documented in the document called "FSUIPC Lua Plug-ins.pdf". For help with Lua programming you can refer to the main Lua reference site "Lua.org" or, for the additions in FSUIPC the "FSUIPC Lua Plug-ins.pdf" document. 1 hour ago, rozelc said: Lots of information there but for me it's like trying "to get a drink of water from a fire hose". All of the documentation supplied is for reference, not reading like a novel. You just look things up when you need to. Make good use of the Contents list where there is one. Perusing the FSUIPC User guide initially is a good idea, just to get an idea of what is available to you. FSUIPC is a bag of tools for you to use as needed. Everyone has different needs. Pete
rozelc Posted September 23, 2021 Author Report Posted September 23, 2021 Hi John, Adding : [Auto] 1=luazelTripleUse Did the trick. BTW I’ve been using FSUIPC since the days of EPIC. Thank you again. Best Rozel
John Dowson Posted September 23, 2021 Report Posted September 23, 2021 1 hour ago, rozelc said: Adding : [Auto] 1=luazelTripleUse Did the trick. As Pete has said - but you should really leave a space after the 'lua', i.e. Quote [Auto] 1=Lua zelTripleUse ...as Pete has already commented. John
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now