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.

How to control event based script
#4
Hi,

event.getvalue() already knows it's current event.dst, so you don't need to pass a variable to the function.

This script below also kills a eventual parallel running script:
Code:
keep_on = grp.getvalue('32/1/4')
if keep_on == false then
  value = event.getvalue()
  if value == true then
     tpid = storage.get('PID:' .. _SCRIPTNAME)
     if tpid ~= nil then
        os.kill(tpid, signal.SIGKILL)
     end
     pid = os.getpid()  
     storage.set('PID:' .. _SCRIPTNAME, pid)
     os.sleep(600)
     grp.write(event.dst, false)
     storage.delete('PID:' .. _SCRIPTNAME)
  end
end
BR,

Erwin
Reply


Messages In This Thread
How to control event based script - by 02dag - 22.09.2018, 18:50
RE: How to control event based script - by Erwin van der Zwart - 23.09.2018, 13:05

Forum Jump: