sleep command dzVents
Posted: Friday 30 March 2018 11:52
Hi All,
I have add all scripts into 1. Easier way to manage local variables and device IDX. But now i see some problems.
It is working so fast that multiple IF statements are runs when its not good.
Is there a way to let the script sleep for een certain time ms or sec before it goes to next if or else if statement?
If this is possible the if statement that must run all commands can be done wait for 1 sec then goto the next.
The next if statement will only act if everything in the if is true or false.
On Internet see lot of options and this one seems only to work but don't know:
But when i add this at end of the if statment i see that after 1 sec for example the commands are running. Not before and then the sleep action.
Cheers,
Peter
I have add all scripts into 1. Easier way to manage local variables and device IDX. But now i see some problems.
It is working so fast that multiple IF statements are runs when its not good.
Is there a way to let the script sleep for een certain time ms or sec before it goes to next if or else if statement?
If this is possible the if statement that must run all commands can be done wait for 1 sec then goto the next.
The next if statement will only act if everything in the if is true or false.
On Internet see lot of options and this one seems only to work but don't know:
Code: Select all
function sleep (a)
local sec = tonumber(os.clock() + a);
while (os.clock() < sec) do
end
endCheers,
Peter