Time loop control - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Time loop control (/showthread.php?tid=2626) |
Time loop control - 38348259 - 05.05.2020 Hi everyone. I am a new LM and lua user, I wonder how can I realize the time loop control? e.g. when I trigger 1/1/1=1, then 1/1/2=1, 1s,1/1/3=1, 1s, 1/1/4=1, and return. When I trigger 1/1/1=0, stop the loop. Thanks a lot RE: Time loop control - Daniel - 05.05.2020 I would do it by two scripts. First event attached to your 1/1/1 which will enable/disable the second resident script. Code: value = event.getvalue() Code: grp.write('1/1/2', true) RE: Time loop control - 38348259 - 05.05.2020 (05.05.2020, 13:25)Thanks a lot. I will try. But can I use while do' or 'repeat until' ?Daniel. Wrote: I would do it by two scripts. First event attached to your 1/1/1 which will enable/disable the second resident script. RE: Time loop control - Daniel - 05.05.2020 Yes but running while loop in event based script for a longer time it is not the best idea. This is the most efficient way for processes. Otherwise you have to make sure that you won't run the same script more than once before ending the previous script. RE: Time loop control - 38348259 - 05.05.2020 (05.05.2020, 14:03)Thank you for your help. Daniel. Wrote: Yes but running while loop in event based script for a longer time it is not the best idea. This is the most efficient way for processes. Otherwise you have to make sure that you won't run the same script more than once before ending the previous script. |