Sign in to follow this  
Followers 0
mithandir1

Help with loop and winexists

2 posts in this topic

#1 ·  Posted (edited)

I originally had a pixelsearch that looked for an error message box. This was causing problems when ingame windows were opened. I decide to replace it with a "if winexist" statement. The problem is I don't know how to exit the loop now :)

Here is the original:

if WinExists("game")then
            do
                sleep(10)
                ToolTip("Everything OK", 0, 0, "Game Bot", 1)
                PixelSearch( 420, 420, 438, 438, 15526360, 10 )
                $err4 = @error 
            until $err4 < 1
            endif
controlsend("Disconnected From Server","","","{enter}")
call("restart")

Here is what I want to do now:

if WinExists("game")then
                do
                ToolTip("Everything OK", 0, 0, "Game Bot", 1)
                    if WinExists("Disconnected From Server")then
                        controlsend("Disconnected From Server","","","{enter}")
                        WinWaitClose("Disconnected From Server")
                    endif
                Until ????
call("restart")

How can I make it exit the second if statement? Do I need to use something besides a "do until" with the new code?

This has me stumped. I really appreciate any help.

EDIT: Apologies for the double post it was an accident and I don't seem to have a delete option

Edited by mithandir1

Share this post


Link to post
Share on other sites



@Mithandir1...From the help file...

AdlibEnable("myadlib")

While WinExists("game")


Wend

Func myadlib()

ToolTip("Everything OK", 0, 0, "Game Bot", 1)
   if WinExists("Disconnected From Server") then
controlsend("Disconnected From Server","","","{enter}")
WinWaitClose("Disconnected From Server")
   endif

EndFunc

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