CMANO Fooling with Fuel

Share your best strategies and tactics with other players by posting them here.

Moderator: MOD_Command

Post Reply
mikmykWS
Posts: 7185
Joined: Tue Mar 22, 2005 4:34 pm

CMANO Fooling with Fuel

Post by mikmykWS »

Quick article on a few fuel related lua scripts

http://www.mikmyk.com/cmano/cmano-fooling-with-fuel/
Dan109
Posts: 175
Joined: Thu Apr 27, 2017 1:04 pm

RE: CMANO Fooling with Fuel

Post 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
Dan109
Posts: 175
Joined: Thu Apr 27, 2017 1:04 pm

RE: CMANO Fooling with Fuel

Post 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)
mikmykWS
Posts: 7185
Joined: Tue Mar 22, 2005 4:34 pm

RE: CMANO Fooling with Fuel

Post 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
mikmykWS
Posts: 7185
Joined: Tue Mar 22, 2005 4:34 pm

RE: CMANO Fooling with Fuel

Post 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
Dan109
Posts: 175
Joined: Thu Apr 27, 2017 1:04 pm

RE: CMANO Fooling with Fuel

Post 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.
mikmykWS
Posts: 7185
Joined: Tue Mar 22, 2005 4:34 pm

RE: CMANO Fooling with Fuel

Post 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
Post Reply

Return to “The War Room”