Someone can't help.
I'm trying to change my simple VD to QA in HC3 where the countdown starts for a defined time. The countdown works.
In HC2 it worked in HC3 I can't set it.
But: I can't stop it with another button during the countdown. How to interrupt, stop the countdown in HC3 LUA? Can't you help with LUA adjustment?
I was trying it in the lines 12-15 but doesnot work. I can interrupt the function during startup.
QA in Attachment.
Thanks.
LUA:
function QuickApp:onInit()
timer2 = self:getVariable("timer2")
timer = tonumber(self:getVariable("timer"))
self.counter = timer*10
if timer == -1 then
self:debug("SET TIME")
self:updateView("label1", "text", "SET TIME")
end
while self.counter > 0 do
if self:getVariable("timer") == "-1" then
self:debug("STOP")
self:updateView("label1", "text", "STOP")
break
else
self:updateView("label1", "text", "START")
self.counter = self.counter -1;
self:debug(self.counter)
hub.sleep(1000)
self:updateView("label2", "text", "remaining time: " ..self.counter)
end
end
if
self.counter ==0
then
self:setVariable("timer", "-1")
self:updateView("label", "text", "SET TIME: 0s")
self:updateView("label1", "text", "STOP")
self:updateView("label2", "text", " remaining times: 0 s")
end
self:debug("QuickApp:onInit")
end
-- set 10s
function QuickApp:Button10s()
self:setVariable("timer", "1")
self:updateView("label", "text", " SET: 10s")
self:updateView("label1", "text", "Waiting")
end
-- button STOP
function QuickApp:STOP()
self:setVariable("timer2", "-1")
self:updateView("label5", "text", "SET TIME: 0s")
self:updateView("label4", "text", "STOPPED")
end
Counter (5).fqa