Logic Machine Forum
Disable resident script when you activate a scene - 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: Disable resident script when you activate a scene (/showthread.php?tid=3681)



Disable resident script when you activate a scene - fahd-bnh - 15.11.2021

Hello Everyone
I hope you could help me in that, 

I have a  resident script called colors, 

value = math.random(0,16777215)
-- wait for 1.5 seconds
os.sleep(2)
grp.update('1/0/1', value)

It change the rgb color automatically, and i have created a virtual boolean to disable/enable the script with this code 

value = event.getvalue()
if value then
  script.enable('colors')
elseif ( value == false ) then
  script.disable('colors')
  grp.write('1/0/1', 0x000000)
end 

And I have created a 1byte object to send  scene values  in grp 32/1/12, and the grp 1/0/1 is inside of that scene. whenever the resident script is on I can't send values to the grp, please how can I disable the script if someone press the scene icon ?
Mant thanks  


GpD7TI


RE: Disable resident script when you activate a scene - admin - 15.11.2021

Do not use os.sleep in your script - set script sleep time instead. When disabling a resident script the system will give it some time to finish the loop. In your case it stops after sending a new random value which usually happens after the scene sends its own value.