Sign in to follow this  
Followers 0
nova4

How to reset, Until = 0 justs keeps going on an on

3 posts in this topic

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.

 

Share this post


Link to post
Share on other sites



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.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

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 :thumbsup:

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0