Loop problems - 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: Loop problems (/showthread.php?tid=1034) |
Loop problems - Jayce - 09.10.2017 Hello, Once again, I'm in need of help. I'm trying to do a simple script that adds few %'s to a DALI light while holding dimming button. I have the button setup as dimmer (brighter), which gives value 9 when I hold it and value 0 when I don't. This is the script I came up with but of course it doesn't work. The loop doesn't break, it just keeps on going even after 100% and keeps updating it. This code is inside the dimming button. 12/0/0 = stm = DALI light object, which has a scale from 0-100%. step = number of % it's supposed to jump each ramp_time Code: value = event.getvalue() I even tried doing: if (value ~= 9) then break but it doesn't work. Any suggestions? RE: Loop problems - admin - 09.10.2017 See this post: https://forum.logicmachine.net/showthread.php?tid=13 The problem is that value is only assigned once, you have to add grp.getvalue inside your loop for script to work. RE: Loop problems - Jayce - 09.10.2017 works nicely, thank you very much. I also wanted to ask you, whenever I create a script and mess up a loop, it cycles infinitely and I have to restart LM. Is there anything else, easier than restarting LM to get rid of the running loop? |