23.02.2022, 11:49
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
scripts are different depending on what, where and when should be included. This is one of those scripts.
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