Помощь - Поиск - Пользователи - Календарь
Полная версия: lua timer
UoKit.com Форумы > Кликер > UO Pilot
TheQQmaster
i checked lua examples
LUA Timer examples

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

P.S mby that teme was but it's hard to search on russian forum if it isn't native language, if such topic exist, link please smile.gif
cirus
Код
--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
TheQQmaster
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

DarkMaster
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 © 2001-2024 Invision Power Services, Inc.