This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Pause an event script
#1
Please tell me if there is a way to interrupt the execution of an event script if this script is already running but has not finished executing. The problem is that when you repeatedly press the light switch, the LM processor starts to load. Since the script execution has not yet completed, and the user presses the same switch several times
Below is an example of one of the scripts
Code:
value = event.getvalue()
local rgbw_color_zal = storage.get('active_rule_3', 3739391)                    
obj_ligth = grp.tag('master_led')

if (value==true) then
    for id, obj in ipairs(obj_ligth) do
    if (obj.datatype==1) then
                grp.write(obj.address, true)                             
    elseif(obj.datatype==5001) then
            grp.write(obj.address, 100)                              
    elseif(obj.datatype==12600) then
            grp.write(obj.address, rgbw_color_zal)             
    elseif(obj.datatype==5) then
      grp.write(obj.address, 0)             
       end
        os.sleep(0.3)
    end
else
    for id, obj in ipairs(obj_ligth) do
    if (obj.datatype==1) then
                grp.write(obj.address, false)                         
    elseif(obj.datatype==5001) then
            grp.write(obj.address, 0)                                      
    elseif(obj.datatype==12600) then
            grp.write(obj.address, 0)                                      
    elseif(obj.datatype==5) then
            grp.write(obj.address, 0)                                     
       end
        os.sleep(0.3)
    end
end
scripts are different depending on what, where and when should be included. This is one of those scripts.
Reply
#2
https://forum.logicmachine.net/showthrea...1#pid19051
------------------------------
Ctrl+F5
Reply
#3
(23.02.2022, 11:55)Daniel Wrote: https://forum.logicmachine.net/showthrea...1#pid19051
Maybe I didn't explain the situation well. The script that is being executed does not need to be stopped, it must be completed to the end, I need that at this moment when this script is being executed, the second instance does not start for execution when a repeated event arrives at the group address
Reply
#4
Then you talking about semaphore
https://openrb.com/docs/semaphore.htm
Consider also using this
https://forum.logicmachine.net/showthrea...4#pid11774
------------------------------
Ctrl+F5
Reply
#5
(23.02.2022, 12:08)Daniel Wrote: Then you talking about semaphore
https://openrb.com/docs/semaphore.htm
Consider also using this
https://forum.logicmachine.net/showthrea...4#pid11774


Thanks
Reply


Forum Jump: