Jump to content
The simFlight Network Forums

How to restart all LUAs?


Recommended Posts

Hello Pete,

do you know any simple way how we could restart all the running LUA scripts? I mean I am using a LOT of LUA stuff here (all of them added to FSUIPC.ini to sections [LuaFiles] and [Auto]. Now imagine that I have done some modifications via notepad in some of them. How can I restart all of them without having to restart the whole FSX (which takes ages)?

 

Thank you,

Pavel

Link to comment
Share on other sites

do you know any simple way how we could restart all the running LUA scripts? I mean I am using a LOT of LUA stuff here (all of them added to FSUIPC.ini to sections [LuaFiles] and [Auto]. Now imagine that I have done some modifications via notepad in some of them. How can I restart all of them without having to restart the whole FSX (which takes ages)?

 

Why do you have so many in the first place? You realise each one takes a thread and is running in your FS PC? 

 

You can kill all Lua plug-ins using the LuaKillAll control. To start them all again you'd have to write another plug-in which uses RunLua to start them all, or program a button with them all assigned to it -- an INI file editing job. Of course if any of them are aircraft or profile specific (i.e. [Auto.<name>] loaded), all you need to do is change aircraft back and forth.

 

Note that killing Lua plug-ins can be hazardous.

 

Regards

Pete

Link to comment
Share on other sites

Ok, thank you. I will give it a try. I tried killing them and starting one of them by FSUIPC key map to Lua OVERHEAD_SWITCH.lua (for example) which did the job but the FSX crashes sometimes (quite often). So yes, it is hazardous.

 

Well - we are using them to interface inputs to FS from various joystick cards and also to send the information to arduinos (by the COM port) in the whole cockpit. We found out we have better results (smoother values received by arduino,...) when using multiple lua files (eg. one file for two engine instruments) then when using one big lua for all the engine instruments. We are a little bit in heaven of switches and needles (I am sure you know how DC9 cockpit looks like). Now we have 16 LUAs and I think the final result will be about 30.

 

Pavel

www.dc-9.eu

Link to comment
Share on other sites

Ok, thank you. I will give it a try. I tried killing them and starting one of them by FSUIPC key map to Lua OVERHEAD_SWITCH.lua (for example) which did the job but the FSX crashes sometimes (quite often). So yes, it is hazardous.

 

If you want to make a habit of stopping them then, if they are looping have them test a flag and use LuaSet to set the flag, upon which they exit tidily, or, for all Lua's with one notification, have them test an offset or button instead. You can use the user offsets 66C0-66FF. 

 

If they are event driven (which is a better design in any case), then, again, you can have an event based on an offset change, which leads them to exit.

 

Well - we are using them to interface inputs to FS from various joystick cards and also to send the information to arduinos (by the COM port) in the whole cockpit. We found out we have better results (smoother values received by arduino,...) when using multiple lua files (eg. one file for two engine instruments) then when using one big lua for all the engine instruments. We are a little bit in heaven of switches and needles (I am sure you know how DC9 cockpit looks like). Now we have 16 LUAs and I think the final result will be about 30.

 

Ah, well 16-30 isn't as many as I thought you meant! ;-) Not so bad.

 

It might be a good idea to start them all from within an [Auto] Lua in any case. I actually use ipcReady.lua, to save even having an [Auto] section. (ipcReady.lua is automatically started in any case and is actually intended for just this purpose, starting a batch of Luas).

 

Pete

Link to comment
Share on other sites

Roger, thank you again!

By the way, is here any way how I can FSUIPC to scan certain joystick without having to map any action to one of its buttons? I mean I have for example one Leo Bodnar board with 32 switches attached and I want to work with all of them insude my LUA using ipc.testbutton - but I have nothing I could map to them via FSUIPC. Do I really have to map some useless function to one button on each of the Bodnar card or is here any better way how to make it visible for LUA?

 

Pavel

Link to comment
Share on other sites

By the way, is here any way how I can FSUIPC to scan certain joystick without having to map any action to one of its buttons? I mean I have for example one Leo Bodnar board with 32 switches attached and I want to work with all of them insude my LUA using ipc.testbutton - but I have nothing I could map to them via FSUIPC. Do I really have to map some useless function to one button on each of the Bodnar card or is here any better way how to make it visible for LUA?

 

Use event.button. That makes sure the relevant joystick is scanned. The only other way would be to pre-declare the joysticks needing scanning, but either way you'd need an event driven plug-in, so why not use the purpose-made facility?

 

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.