event script e os.sleep - 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: event script e os.sleep (/showthread.php?tid=2991) |
event script e os.sleep - Frank68 - 18.11.2020 Hello I am trying with an event-based script when the value of a byte changes, to send mail, the byte can have value 0,1,2 my problem ache inside the script I should delay sending the mail for a time and re-read the value, as it takes time to pass between the various values, I tried with os.sleep () and to read the value after the time but it doesn't work, is there another way to do this function? thanks a lot RE: event script e os.sleep - admin - 18.11.2020 Are you using event.getvalue()? You should use grp.getvalue(event.dst) after sleep. RE: event script e os.sleep - Frank68 - 18.11.2020 (18.11.2020, 10:20)admin Wrote: Are you using event.getvalue()? You should use grp.getvalue(event.dst) after sleep.Hi I use grp.getvalue(event.dst) this is my code Code: -- INDICAZIONI COMUNI in my code I would like, if possible, that only after a certain period, depending on the value 0,1,2, delel actions were performed, but unfortunately seeing from the log ('value n'), 0 is always also executed without taking into account the time 15 cesondi, in this period the value has changed state and is no longer 0, in practice only if I have 0 after a certain period I have to perform an action. available for clarification thanks RE: event script e os.sleep - admin - 18.11.2020 You have this check: if(value~=OldVal) then but you say you want to execute a certain action only when a value has not changed in the past 15 seconds. I think an event script is not a ideal solution here because each value change will trigger another script. How often does this value change? You can try a resident script that checks the object value every second and resets/increases a timer variable depending whether the value has changed or not. |