#Delay/wait/sleep in RPN code?

1 messages · Page 1 of 1 (latest)

quiet raft
#

Anyone know syntax for waiting [x]ms for next command? Using an input config to do multiple button presses, but would like to include delays in between.

flat sparrow
#

Hello I will follow your thread because I ask myself the same questions concerning the timers.
I created a topic under the title "Timer in Mobiflight with or without LUA script" and Jaime Leon told me about RPN programming.

coral urchin
#

There is no delay, sleep or wait function in Mobiflight or MSFS RPN.

#

In general, you want to set in an input event a variable to the target Sim time by reading current time and adding the desired time.

#

Then check the status of the timer in an output config if the timer variable is not zero until current Sim time is greater than the Target time.

#

When that happens, reset the timer variable to zero and send whatever commands are required.

#

I have to say this is not too difficult to do, but requires a clear understanding of how the process works.

#

For the input part,
(E:SIMULATION TIME,second) 5 + (>L:myTimer)

#

This just stores the target time to myTimer Lvar for a 5 second timer.

#

For the output part

#
(L:myTimer) 0 > if{
(E:SIMULATION TIME,second) (L:myTimer) > if{
0 (>L:myTimer)
Here goes whatever code to be executed once after timer expires } }
#

Checks L:myTimer is greater than 0. If false, do nothing. If true, check current time is greater than target time. If false, do nothing. If true, reset timer Lvar and execute intended code only once.

quiet raft
#

Thanks for the explanation. I have a key bound to set the three adirs and just wanted some delay so they don't execute all at once, but seems like this would require a series of inputs/outputs talking to each other to execute since there's no simple wait/delay