Jump to content
The simFlight Network Forums

1 keyboard press = Run/Kill 4 lua's


Recommended Posts

Hello,

I have 4 lua's for my A2A B17 all running on my Saitek X52 Pro axis Rx rotary. I'm running the multiaxis.lua plus P.D. Strogens turbo lua and then my modified of Strogens for heater, windows, and intercooler lua's. I have them assigned to run individually on left arrow, right arrow, up arrow and down arrow and then kill individually on Cntrl + xxxx arrow.

 

What I would really rather have is for one key press to run choosen lua and kill the others. I hope this is not a repeat of a previous topic. If so I was unable to locate it. I've been through the manual(s) but have not located a way to do what I'm hoping to do.

 

These are my current commands set is Key Presses.

 

[Keys.B-17]
12=37,8,L7:R,0
14=39,8,L13:R,0
16=38,8,L5:R,0
18=40,8,L6:R,0
20=37,10,L7:K,0
22=39,10,L13:K,0
24=38,10,L5:K,0
25=40,10,L6:K,0

 

Thanks for the great progam Pete and for any help.  B)

 

Roger

Link to comment
Share on other sites

I have 4 lua's for my A2A B17 all running on my Saitek X52 Pro axis Rx rotary. I'm running the multiaxis.lua plus P.D. Strogens turbo lua and then my modified of Strogens for heater, windows, and intercooler lua's. I have them assigned to run individually on left arrow, right arrow, up arrow and down arrow and then kill individually on Cntrl + xxxx arrow.

 

"Killing" Lua plug-ins is NOT really a good idea. The facility is provided for occasional use when this proves necessary, but there are much safer and more effective ways to dealing with program control. Killing threads can leave things in a strange state sometimes. I've taken lots of steps to try to ensure it doesn't actually crash the sim, but I'm not sure even then I can cover all circumstances. It all depends what the plug-in is doing with other parts of the system.

 

A much better idea is to have the plug-ins event driven, so they loaded, but dormant until they need to do something. There are event functions for activating them on button press, key press, or just flag or parameter changing.

 

If you really want them to terminate, setting one of the 32 available flags for each plug-in should suffice, programming it to test it and is set to ends by simply exiting the loop or using ipc.exit().

 

What I would really rather have is for one key press to run choosen lua and kill the others. I hope this is not a repeat of a previous topic. If so I was unable to locate it. I've been through the manual(s) but have not located a way to do what I'm hoping to do.

 

 
If you really must do something like that, there is nothing stopping you assigning as many actions as you need to each keypress. You have to do this by editing the INI file, as the in-program dialogue can only assign one thing to each.
 
Pete
Link to comment
Share on other sites

Hi Pete,

 

reading this post some doubts raised to me and I would have your suggestion and point of view about them.

 

I have created a very huge number of LUA files that reading offsets execute after specific actions when I use a keys sequence or I press buttons on my several FSX devices: in term of performances and resources usage do you think could be the case I try to put all of them together using the 'ipc.event' command or can I maintain them in the different LUA files?

 

Thanks in advance and kind regards

 

Joe

Link to comment
Share on other sites

I have created a very huge number of LUA files that reading offsets execute after specific actions when I use a keys sequence or I press buttons on my several FSX devices: in term of performances and resources usage do you think could be the case I try to put all of them together using the 'ipc.event' command or can I maintain them in the different LUA files?

 

It is always better to use events in any case. The plug-in is then only read and compiled the once, and it is dormant until the event(s) happen(s).  With it being reloaded and recompiled each time you are fragmenting memory unnecessarily as well as causing the processor overheads of unnecessarily repeating the same thread creation, file access, compilation and thread destruction each time.

 

And for similar reasons it would be more efficient to have one plug-in, one thread, one area of memory occupation, for all similar things always used together.

 

Pete

Link to comment
Share on other sites

For some reason I am struggling with some of this. I did more reading of manuals tonight and looking at the user contributions section. I'm "starting" to get my head around this. I'll keep at it... I'm determined and stubborn ;)

 

Well, if you want to post what you are doing and say what you want to do with it I should be able to help. Don't attach files, though, just paste them and use the <> button above the edit area to enclose them.

 

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.