i checked lua examples
https://uopilot.uokit.com/wiki/index.php?title=Timer_(Lua)
i dont want to wait on while loop, i want that it do like example on pilots language, it do on start and then after x time passed it do it again and go to next block
it need for if statement
any examples?
--lua
repeat
// do something on script start and then after is x time passed
// do next block
until false
:start
if #timeStance < timer //stances
//do smth on start, then after 14 sec passed he do this block again
set #timeStance timer + 1000 * 60 * 14
end_if
//more blocks with if timers
goto start
--lua
log 'clear' log 'mode compact'
local t1 = 0
local t2 = 0
local t3 = 0
while true do
if os.clock() > t1 then
log ('action 1')
t1 = os.clock() + 3
end
if os.clock() > t2 then
log ('action 2')
t2 = os.clock() + 10
end
if os.clock() > t3 then
log ('action 3')
t3 = os.clock() + 1
end
wait(10)
end
thank you again
what is diffrence in thoose loops and what is better to use and why u use exactly while
пиши на русском
p.s as far i get repeat it will run atleast 1 time, while it will not run on start if false, am i right?
--lua
while true do
end
repeat
until false
while check condition before start cycle, repeat - after. You are right, repeat will run minimum 1 time.
"Repeat" will work up to "true", "while" will work up to "false", then script will go to next block of code.
Русская версия Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)