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


Messages In This Thread
Pause an event script - by sashhun - 23.02.2022, 11:49
RE: Pause an event script - by Daniel - 23.02.2022, 11:55
RE: Pause an event script - by sashhun - 23.02.2022, 12:00
RE: Pause an event script - by Daniel - 23.02.2022, 12:08
RE: Pause an event script - by sashhun - 23.02.2022, 12:20

Forum Jump: