nova4 Posted April 11, 2014 Share Posted April 11, 2014 Hello ppl of the forum, im new and im a noob i downloaded autoittool a couple of days ago, and i know nothing of scripts but ive been reading. So this is the script i want to reset Global $start = TimerInit() Local $restart = 15 Global $state = "Init"; Init(); While 1 Start() WEnd Func Init() EndFunc Func Start() Do Sleep(1000) ToolTip("Restarting in: " & $restart & "", 1, 1) $restart = $restart - 1 Until $restart = 0 sleep(2000) EndFunc This part of script is inside another bigger one, that always restarts like is intended to, and this 15 countdown is just a waiting time i have before it restart all the big script, i could use sleep but i like the counter, the only problem is it justs keeps going on from 0, -1, -23-, etc. etc. -23234, etc. i want it to restart from 15 everytime it get to this part of the code. the frist time it works, but then the 2cond time the script resets, it dosent work it goes to minus negative numbers and the scrip just dosent seem to work anymore. THats it, thanks ppl. Link to comment Share on other sites More sharing options...
Solution FireFox Posted April 11, 2014 Solution Share Posted April 11, 2014 Hi, Welcome to the autoit forum If you follow what the scripts does, you will see your counter is never reset. ;1 Global $start = TimerInit() Local $restart = 15 Global $state = "Init"; ;2 Init(); While 1 ;4 Start() ;8 ;$restart = 0 ;and then step 9 is step 4 because it's a loop ;so the $restart will be decremented from 0 and not from 15 WEnd Func Init() ;3 EndFunc ;==>Init Func Start() ;5 ;$restart = 15 Do ;6 ;$restart = 15 ... 0 Sleep(1000) ToolTip("Restarting in: " & $restart & "", 1, 1) $restart = $restart - 1 Until $restart = 0 Sleep(2000) ;7 ;$restart = 0 EndFunc ;==>Start I let you fix it by yourself. Br, FireFox. Link to comment Share on other sites More sharing options...
nova4 Posted April 11, 2014 Author Share Posted April 11, 2014 Thanks, very usefull i know my question are to basic but i dont know anything about programing, or doing scrips or codes, etc. But now i can do a 15 secs timer. lol Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now