Sign in to follow this  
Followers 0
mithandir1

Need help with PixelSearch Timeout

3 posts in this topic

#1 ·  Posted (edited)

What I am doing is checking for white text on the character select screen after I login to a game. This is the only constant color on this particular screen. This works perfectly as a timer for load time variation. The problem is sometimes I get a server full try again message. So my script is searching for a color in an infinite loop. All the while the game is waiting for relog.

How can I make this loop timeout after 30 seconds?

func chardetect()
do
 sleep (10)
PixelSearch( 671, 71, 736, 137, 0xfefefe, 10);search for white on char screen
 $err2 = @error
until $err2 < 1
ToolTip("Login Succesful", 0, 0)
endfunc
Edited by mithandir1

Share this post


Link to post
Share on other sites

#2 ·  Posted (edited)

func chardetect()
    Local $login = True
    Local $time = 30 ;sec
    $timer = TimerInit()
    do
        sleep (10)
        PixelSearch( 671, 71, 736, 137, 0xfefefe, 10);search for white on char screen
        $err2 = @error
        if TimerDiff($timer) >= $time*1000 Then
            $login = False
            ExitLoop
        EndIf
    until $err2 < 1
    if $login = True Then
        ToolTip("Login Succesful", 0, 0, "GameName bot:", 1)
    Else
        ToolTip("Character wasn't detected within 30 sec.", 0, 0, "GameName bot:", 3)
    EndIf
endfunc

Edited by sandin

Share this post


Link to post
Share on other sites

this works perfectly. I also want to thank you for pointing out the tool tip options.

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