ken_f15j Posted April 21, 2019 Report Share Posted April 21, 2019 (edited) Hello! I try to make Lua script that connecting QW787 and VATSIM cliant (vPilot) but it does not function. Is there any idea ? Using P3Dv4.5, QW787 P3D v1.1.3 and registed FSUIPC5 Installed my lua into Prepar3D v4\Scripts folder like that QW787xpnder.lua local qw_xpnder = varget("L:QW_AFT_Transponder_Knob", "Enum") if qw_xpnder == 0 or qw_xpnder == 1 then ipc.writeSB(0x7B91, 1) elseif qw_xpnder == 2 or qw_xpnder == 3 or qw_xpnder == 4 then ipc.writeSB(0x7B91, 0) end put "FSUIPC5.ini" in Prepar3D v4\Modules folder as below. [Auto] 1=Lua QW787xpnder made Lua following SquawkBox SDK FSUIPC Offsets, and Qualitywings 787 sim builder kit http://www.squawkbox.ca/doc/sdk/fsuipc.php http://www.qualitywingssim.com/v.2.0.1.8/Documentation.php Edited April 21, 2019 by ken_f15j Link to comment Share on other sites More sharing options...
Pete Dowson Posted April 21, 2019 Report Share Posted April 21, 2019 10 hours ago, ken_f15j said: I try to make Lua script that connecting QW787 and VATSIM cliant (vPilot) but it does not function. If you looked in the FSUIPC Log file you would see the reason, as you have a definite error: 10 hours ago, ken_f15j said: local qw_xpnder = varget("L:QW_AFT_Transponder_Knob", "Enum") The FSUIPC Lua library document tells you that the correct function to read an L_Var value is: n = ipc.readLvar(“name”) I think you are perhaps trying to use something from FS XML gauge language? Or maybe the more recent addition of Lua to FS (in P3D?). 10 hours ago, ken_f15j said: made Lua following SquawkBox SDK FSUIPC Offsets, and Qualitywings 787 sim builder kit Aha! Seems for FSUIPC plug-ins you need to follow FSUIPC odcumentation instead!. That should not be surprising, I hope? Pete Link to comment Share on other sites More sharing options...
John Dowson Posted April 22, 2019 Report Share Posted April 22, 2019 Also FSUIPC only scans one folder for lua plugins, which by default (unless 'LuaPath' is specified) is the Prepar3D v4\Modules folder (or the location of your FSUIPC5.dll), not the Prepar3D v4\Scripts folder. John Link to comment Share on other sites More sharing options...
Milan Putnik Posted May 27, 2019 Report Share Posted May 27, 2019 (edited) Greetings, I would like to know how does this play out - did Ken manage to make the script working ? If yes, I'd love to have it if possible ? Best Regards,Mr.sci.ing. MILAN PUTNIK Edited May 27, 2019 by Milan Putnik Link to comment Share on other sites More sharing options...
Pete Dowson Posted May 27, 2019 Report Share Posted May 27, 2019 1 hour ago, Milan Putnik said: did Ken manage to make the script working ? I don't know. But he put the script in his first message, with just the error that he tried to use "varget" instead of "ipc.readLvar". So why not try it? Pete Link to comment Share on other sites More sharing options...
spokes2112 Posted May 27, 2019 Report Share Posted May 27, 2019 The first code probably wouldn't work, even if corrected, unless it was part of some other coding - it is a "one shot". Meaning it loads once then does nothing. The following "should" work (not tested) as long as the documentation of SB3 is forward compatible with vPilot & that the QW documentation is correct too. It also includes the ident button. Use [Auto] to start. (even better with profiles) -- SETTING 1 TO OFFSET EQUALS OFF / STANDBY FOR THE XPNDR function vPilot_XPNDR (varname, value) if value < 2 then ipc.writeSB(0x7B91, 1) else ipc.writeSB(0x7B91, 0) end end function vPilot_IDENT (varname, value) if value == 1 then ipc.writeSB(0x7B93, 1) end end event.Lvar("QW_AFT_Transponder_Knob", 250, "vPilot_XPNDR") event.Lvar("QW_AFT_Transponder_Button", 250, "vPilot_IDENT") Link to comment Share on other sites More sharing options...
Pete Dowson Posted May 27, 2019 Report Share Posted May 27, 2019 58 minutes ago, spokes2112 said: The following "should" work (not tested) as long as the documentation of SB3 is forward compatible with vPilot & that the QW documentation is correct too. It also includes the ident button. Use [Auto] to start. (even better with profiles) Thanks! Pete Link to comment Share on other sites More sharing options...
Milan Putnik Posted May 27, 2019 Report Share Posted May 27, 2019 (edited) Greetings, I made the corrections pointed out by Mr.Dowson right after I read the topic, alas couldn't get it to work. I am also not adept at LUA programming. Now trying the latest script by Spokes2112 - that looks as if it's in a different formatting altogether - hope this one works.Thank You !Mr.sci.ing. MILAN PUTNIK Edited May 27, 2019 by Milan Putnik Link to comment Share on other sites More sharing options...
Milan Putnik Posted May 27, 2019 Report Share Posted May 27, 2019 (edited) 3 hours ago, spokes2112 said: The first code probably wouldn't work, even if corrected, unless it was part of some other coding - it is a "one shot". Meaning it loads once then does nothing. The following "should" work (not tested) as long as the documentation of SB3 is forward compatible with vPilot & that the QW documentation is correct too. It also includes the ident button. Use [Auto] to start. (even better with profiles) -- SETTING 1 TO OFFSET EQUALS OFF / STANDBY FOR THE XPNDR function vPilot_XPNDR (varname, value) if value < 2 then ipc.writeSB(0x7B91, 1) else ipc.writeSB(0x7B91, 0) end end function vPilot_IDENT (varname, value) if value == 1 then ipc.writeSB(0x7b93, 1) end end event.Lvar("QW_AFT_Transponder_Knob", 250, "vPilot_XPNDR") event.Lvar("QW_AFT_Transponder_Button", 250, "vPilot_IDENT") What a genius - THANK YOU IT WORKS - only had to fix the letter "b" in IDENT offset to the capital "B", thus: ipc.writeSB(0x7B93, 1) Edited May 27, 2019 by Milan Putnik 1 Link to comment Share on other sites More sharing options...
Milan Putnik Posted May 27, 2019 Report Share Posted May 27, 2019 (edited) P.S. For anyone who comes here and uses this script - there is an issue with the IDENT button in QW787 not resetting back to it's position, staying pressed until you press it with the right mouse button - and it cannot be visually noticed at all. The result is that you'll get the IDENT function working only once - pressing the button further won't function anymore. It can be tackled by, for example, simply adding a line with the U (on button release) command for the button in a MACRO script ending with the parameter 1 (right mouse button press) - the way I've done it - for my selected physical button for the IDENT button in the cockpit . Anyway, we have a working script.Thank You !Mr.sci.ing. MILAN PUTNIK Edited May 28, 2019 by Milan Putnik Link to comment Share on other sites More sharing options...
spokes2112 Posted May 27, 2019 Report Share Posted May 27, 2019 Milan, Excellent - Glad it worked for you! Edited my post above with the capital "B" in case anyone else wants to use it. Thanks Roman Link to comment Share on other sites More sharing options...
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