Sign in to follow this  
Followers 0
stackover

TimerInit()

11 posts in this topic

If I set a variable for example $time = TimerInit(). This will be a counter. Is there a comand to stop this counter? Not restart counter.

It will be wonderfull that I can stop this timer and set it too to timer = 0.

Thanks

Share this post


Link to post
Share on other sites



$time = TimerInit()
Sleep(2000)
$diff = TimerDiff($time)
MsgBox(0, 'info', $diff & @CR & $time)
$time = 0 ;Reset
MsgBox(0, 'info', $time)


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Doesnt work. Timmer still running and when I restart function he starts calling job that was to do after 20 secs

Share this post


Link to post
Share on other sites

Doesnt work. Timmer still running and when I restart function he starts calling job that was to do after 20 secs

show the code you use so we can see what you are doing ....

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

;Auto Party
Global $AutoParty = False
Global $AutoPartyOnOff = False
Global $Time4Party = 20000
Global $ChangingAutoParty = 0

HotkeySet ("{F9}", "OnOff")
HotkeySet ("{END}", "OnOff")

Func OnOff()
If @HotKeyPressed = '{F9}' Then
        $ChangingAutoParty = $ChangingAutoParty +1
        If $AutoParty = False Then
        $AutoParty = True
        Else
        $AutoPartyOnOff = False
        Endif
EndIf

 If @HotKeyPressed = '{END}' Then
     
        If $AutoParty = True Then
        $AutoParty = False
        $ContAutoParty = 0
        $ChangingAutoParty = 0
        EndIf
EndIf
EndFunc

While 1

If $AutoParty Then
        Switch $ChangingAutoParty
            Case 1
                If Not $AutoPartyOnOff Then
                    $AutoPartyOnOff = True
                    $ContAutoParty = TimerInit()
                ElseIf TimerDiff($ContAutoParty) >= $Time4Party Then
                    MouseClick("Right")
                    $AutoPartyOnOff = False
                EndIf
            Case 2
                $ChangingAutoParty = 0
        EndSwitch
    EndIf
WEnd

Im trying to stop $ContAutoParty and restart to 0 and only starts again when I hit F9

PS: Code now no errors

Edited by stackover

Share this post


Link to post
Share on other sites

Im trying to stop $ContAutoParty and restart to 0 and only starts again when I hit F9

it's very hard to follow your "logic", based on that code. I do have a strong feeling, that 80% of your code can be eliminated, if ONLY we knew what you want to do.....

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Are confused my code ?

PS; I posted only function that dont counter dont stop.. Sorry I dont post all code coz it have more than 2k lines... :)

Edited by stackover

Share this post


Link to post
Share on other sites

Are confused my code ?

PS; I posted only function that dont counter dont stop.. Sorry I dont post all code coz it have more than 2k lines... :)

yes, confused, and please DON'T post the whole code. Just explain what you want to do. I don't get it ....


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Are confused my code ?

PS; I posted only function that dont counter dont stop.. Sorry I dont post all code coz it have more than 2k lines... :)

we don;t need to see the 2k lines of code.. just a working scriptlet that works and shows your problem .... Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

@ JdeB .. I made changes in code .. now its works ..

@/dev/null ... I have a single while for script run all time and one fucntion.. in this function has a counter ... inside while has 2 conditions ... one to stop script ans other to do a thing 20 segs in 20 segs ... when i stop script I want counter stop and got value 0 ... but if I wait 40 sec for exemplo to start script again .. when I press it start doing job that was to be done after 20 segs .. so I know that counter are > than 20 segs .. its thats..

more clear now I hope .. sry for confusion

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