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.

Object write with
#1
Hi, can You help me, the red part of script doesnt work to me. I need if STAV==1, to wait 5times x 10sec if it change to 0.

STAV=grp.getvalue("10/1/181")
pocet=5

if (event.getvalue()==true)
  then
  if(STAV==0)
    then
    grp.write("10/0/0", true)
    end
  else
  repeat
    os.sleep(10)
    pocet=pocet-1
    if(STAV==0)
      then
       grp.write("10/0/0", true)
   end
  until (pocet==0)
end
Reply
#2
I think the script will not work because of your 2nd IF statement and the declaration of STAV at the beginning.

if STAV = 0 then do something, but if STAV is not zero do something ELSE.
Then in that ELSE statement you check in your REPEAT loop if STAV is 0 again, but you ended there because STAV was something else than zero and you don't re-poll the STAV value, so you'll never meet that condition. I guess...
Reply
#3
(19.01.2023, 20:07)tigi Wrote: I think the script will not work because of your 2nd IF statement and the declaration of STAV at the beginning.

if STAV = 0 then do something, but if STAV is not zero do something ELSE.
Then in that ELSE statement you check in your REPEAT loop if STAV is 0 again, but you ended there because STAV was something else than zero and you don't re-poll the STAV value, so you'll never meet that condition. I guess...

I think so this is problem with update object, but how to do update of STAV during repeat?
Reply
#4
You need to add another grp.getvalue call before checking the value.
Reply


Forum Jump: