Page 1 of 1
CMANO Fooling with Fuel
Posted: Fri Jun 02, 2017 3:57 pm
by mikmykWS
RE: CMANO Fooling with Fuel
Posted: Fri Jun 02, 2017 10:45 pm
by Dan109
Hi Mike,
Great example. But this got me to thinking, LUA scripts can be run in parallel? Use of the "wait" command is telling me LUA will be stuck in that loop for a while. I didn't realize LUA was able to run in parallel with the scenario.
An explicit example of what I was wanting to do was to work on a shoot-n-scoot script for Radars. Rather than call the script every 5s, I can launch it once, go through my code and wait(5) and repeat? All, while having other scripts that might get triggered in parallel?
Cheers,
Dan
RE: CMANO Fooling with Fuel
Posted: Tue Jun 06, 2017 4:44 am
by Dan109
Mike,
I was fooling around with 'wait' - well, the 5.3 LUA Documentation I looked at didn't have it, but saw from google searches, that people have made home grown wait functions using the clock library. So, It tried it...and it kinda just froze all of CMANO during the wait period - so, fairly useless IMO in 1.12. Was your script using a future dev build that will have some interesting LUA improvements?
Cheers,
Dan
(Or was I taking your script WAY TOO literally, and you meant that the wait statement was for just a general amount of time passing in the game)
RE: CMANO Fooling with Fuel
Posted: Wed Jun 07, 2017 8:27 am
by mikmykWS
Hi Dan
Wrote it some time ago for a pro request and worked great. I'll take a look though and see what's going on. Will update the blog post with any findings or new code.
Mike
RE: CMANO Fooling with Fuel
Posted: Wed Jun 07, 2017 1:11 pm
by mikmykWS
Yeah wait isn't a good option but there is an easier way. A regular time trigger offers a form of persistence.
So fix would be something like this.
1. Create a regular time trigger for a second.
2.lua action to run the check.
3. Create a repeatable event and suppress the event log message
Mike
RE: CMANO Fooling with Fuel
Posted: Wed Jun 07, 2017 5:41 pm
by Dan109
Ok, that makes sense. And that also makes me conclude that multiple LUA scripts cannot be executing at the same time, and unless doing your above suggested "event wait 1s" technique, all UI time is considered frozen until the completion of a LUA script.
RE: CMANO Fooling with Fuel
Posted: Wed Jun 07, 2017 6:02 pm
by mikmykWS
I've executed multiple scripts using the same trigger so I don't arrive at the conclusion they can't be run at the same time although would have to watch the execution to know for sure. It could very well be one after another. Given these scripts achieved their purpose I'm not sure I really care [8D]
Mike