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.

Disable resident script when you activate a scene
#1
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
Reply
#2
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.
Reply


Forum Jump: