Jump to content
The simFlight Network Forums

Two LUA scripts with one button


Recommended Posts

MOVED FROM USER CONTRIBUTIONS SUBFORUM

 

Hello,

i already read advanced user manual and a lot of internet forums, but still i can't find solution..

I have two simple LUA scripts:

1) LTS_Taxi.lua

LOC = ipc.readLvar("L:AB_TAXI_LT")
if(LOC == 1) then 
ipc.writeLvar("L:AB_TAXI_LT", 0)
else
ipc.writeLvar("L:AB_TAXI_LT", 1)
end
ipc.writeLvar("L:SmallOverheadPushButtons", 1)

2) LS button.lua

LS = ipc.readLvar("L:AB_MPL_ILS")
if(LS == 1) then 
ipc.writeLvar("L:AB_MPL_ILS", 0)
else
ipc.writeLvar("L:AB_MPL_ILS", 1)
end
ipc.writeLvar("L:SmallOverheadPushButtons", 1)

Both work standalone without any problem.

Is it any way how i can run this two scripts together when i'm using one button?
In FSX i set button for first script. Then in FSUIPC.INI file i found :

30=P109,5,CL53:R,0     -{Lua LTS_Taxi}-

and manually added next line

31=P109,5,CL53:R,0     -{Lua LS button}-

But when i start FSX and push the button - nothing happened. So i close FSX, open FSUIPC.INI file and find:

30=P109,5,CL53:R,0     -{Lua LTS_Taxi}-
30=P109,5,CL53:R,0     -{Lua LTS_Taxi}-

Name of my second LUA script was changed to LTS Taxi. 

What m'i doing wrong and is it possible have two scripts on one button?
Thanks lot for your answer in advance and sorry for my english.

 

 

 

Link to comment
Share on other sites

14 hours ago, MartyCZE said:

Name of my second LUA script was changed to LTS Taxi. 

The file hasn't been renamed, only the annotation -- because Lua file 53 is LTS Taxi.

When editing the INI file, do NOT edit the annotation. That is placed there by FSUIPC to show its interpretation of the lines. If you want to add comments do so immediately after the control line itself, and precede it with a ; (semi-colon). The annotations, everything after the -{, are deleted and replaced everytime FSUIPC interprets the lines.

Both of your original lines refer to the same Lua plug-in, number 53! How do you expect FSUIPC to do something different for an identical assignment?  Both are " P109,5,CL53:R,0". Where can anything detect a difference?

Use the correct number for the Lua file as listed in the [LuaFiles] section.

AND please, next time you post a support question, post to the Support Forum, not to any old Subforum you find. They are for selected library reference subjects, not for ongoing live support.

Pete

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.