Jump to content

TimerInit()


Recommended Posts

  • Moderators

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

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.

Link to comment
Share on other sites

  • Developers

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 ....

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

;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
Link to comment
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 *

Link to comment
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 *

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...