Jump to content

Recommended Posts

Posted (edited)

I'll explain it. It's not really specific to the looping.

TimerDiff returns the time difference (in milliseconds) from a previous call to TimerInit().

For example we have this script:

$init = TimerInit()

While TimerDiff($init) <= 1000
    Sleep(100)
Wend

This script will make 10 loops. Why?

First loop 0ms, second loop 100ms, third loop 300ms, fourth loop 400ms. Then loop 10 = 1000ms, loop 11 = 1100ms but that's too much. 1100 <= 1000 is False.

So what you need to do now is correct your script, so that the value that the time difference must be smalelr than 10 minutes expressed in milliseconds.

@Volly, epicfail is a little slow to understand. He has the ability to understand many things, but just doesn't see the connection between some things. He needs some special help. 8)

Edited by Manadar
Posted

i was doing some playing around and came up with this not sure what 1 is right both seem to work. What 1 is the right way?

$init = TimerInit()

While TimerDiff($init) <  600000
    If WinActive("Untitled -") Then
        ExitLoop
    EndIf
Wend

$init = TimerInit()

While TimerDiff($init) <  600000
    If WinActive("Untitled -") Then
        ExitLoop
    EndIf
    If TimerDiff($init) > 600000 Then
        ExitLoop
    EndIf
Wend
Posted (edited)

$init = TimerInit()

While TimerDiff($init) <  600000
    If WinActive("Untitled -") Then
        ExitLoop
    EndIf
Wend
Exit

Or

$init = TimerInit()

While 1
    If TimerDiff($init) >  600000 Then
        Exit ; Note this says > 600000 instead of < 600000
    EndIf
    If WinActive("Untitled -") Then
        ExitLoop
    EndIf
Wend
Exit
Edited by Manadar
Posted

I added a sleep in there so the CPU doesn't go crazy.

$init = TimerInit()

While TimerDiff($init) <  600000
    If WinActive("Untitled -") Then
        ExitLoop
    EndIf
    Sleep(50)
Wend
Exit

Or

$init = TimerInit()

While 1
    If TimerDiff($init) >  600000 Then
        Exit ; Note this says > 600000 instead of < 600000
    EndIf
    If WinActive("Untitled -") Then
        ExitLoop
    EndIf
    sleep(50)
Wend
Exit
Posted

ok something else say i have other stuff after my while that i dont want to be done after i exit my loop how would i stop it from doing them? if i use exit it will exit but i want to be able to use my gui still so dont want to fully exit the program.

Posted (edited)

a bot 4 a facebook game lol just wanted to try to learn something new. hehe now i have just learnt how to use this to make error ini and send it to a webhost.

Edited by epicfail

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
×
×
  • Create New...