Jump to content

Why wont this loop start?


Recommended Posts

I'm new to AutoIt and this is my armature bot script. If you don't like bots PLEASE KEEP IT TO YOURSELF AND DON'T POST!!! Please only post if your willing to help. Ive learnt lots of AutoIt basics through making this newb bot so please dont flame my thread :)

Regards

- muzle6074

The problem

The loop "While $BG = True" is never been started and I checked this by outputting a msgbox when it's suppose to starts Can you see why the loop doesn't get executed after all the above conditions are met?

$szTitle = "World of Warcraft"

WinWaitActive($szTitle);wait for WoW window
WinMove($szTitle, "", 0, 0, 1570, 1000);move and resize WoW window

$BGJoinQueue = False
$BG = False

While 1
    Sleep(random(4000, 5000))
    MouseClick("Right", 800, 575, 1)
    $BGJoinQueueColor=PixelGetColor(285, 640)
    If hex($BGJoinQueueColor, 6) = "680300" then;wait for join battle menu
        MouseClick("Left", 285, 640, 2)
        MouseMove(400, 400)
        Sleep(random(9000, 10000))
        $BGJoinQueueColorSuccessfully=PixelGetColor(1415, 210)
        If Hex($BGJoinQueueColorSuccessfully, 6) = "A5822B" Then
            $BGJoinQueue = True
        EndIf
    EndIf
    While $BGJoinQueue = True
        Sleep(250)
        $BGJoinGameColor=PixelGetColor(760, 250)
        If Hex($BGJoinGameColor, 6) = "6F0000" Then
            MouseClick("Left", 760, 250, 1)
              $BG = True
            Sleep(random(15000, 20000))
        EndIf
    WEnd
    While $BG = True
        For $i=Random(1800, 2400) to 1 Step -1
            Sleep(50)
            $BGEndColor=PixelGetColor(790, 710)
            $ResColor=PixelGetColor(740, 240)
            $ResCancelColor=PixelGetColor(820, 235)
            If Hex($BGEndColor, 6) = "690505" Then;if the battle ground has ended
                MouseClick("Left", 790, 710, 2)
                MouseMove(400, 400)
                $BGJoinQueue = False
                $BG = False
                Sleep(random(15000, 20000))
                ExitLoop
            ElseIf Hex($ResColor, 6) = "F1C300" Then;if chracter is dead
                MouseClick("Left", 740, 240, 2)
                MouseMove(400, 400)
            ElseIf Hex($ResCancelColor, 6) = "700100" Then;cancel resurrecting
                MouseClick("Left", 820, 235, 2)
                MouseMove(400, 400)
            EndIf
        Next
        Send("{SPACE}")
    WEnd
WEnd
Link to comment
Share on other sites

Does it stay in this while?

While $BGJoinQueue = True
        Sleep(250)
        $BGJoinGameColor=PixelGetColor(760, 250)
        If Hex($BGJoinGameColor, 6) = "6F0000" Then
            MouseClick("Left", 760, 250, 1)
              $BG = True
            Sleep(random(15000, 20000))
        EndIf
    WEnd

You make $BG = True, but it never comes out the while?

Link to comment
Share on other sites

Probably getting stuck here. Change $BGJoinQueue = True to False and see if it goes to the next step. It would probably be better to make a Select...Case statement though.

While $BGJoinQueue = True
Sleep(250)
$BGJoinGameColor=PixelGetColor(760, 250)
If Hex($BGJoinGameColor, 6) = "6F0000" Then
MouseClick("Left", 760, 250, 1)
$BG = True
Sleep(random(15000, 20000))
EndIf
WEnd

Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

Link to comment
Share on other sites

Thanks for the quick response xzaz and Fossil Rock.

I now see that it never gets a chance to leave the while condition :) how silly of me...

I changed it to this:

While $BGJoinQueue = True
Sleep(250)
$BGJoinGameColor=PixelGetColor(760, 250)
If Hex($BGJoinGameColor, 6) = "6F0000" Then
MouseClick("Left", 760, 250, 1)
$BG = True
$BGJoinQueue = False
Sleep(random(15000, 20000))
EndIf
WEnd
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...