Jump to content

Help/Support with my Script


andrew01
 Share

Recommended Posts

Ok so basically I started looking into Auto-It a few days ago and started tinkering around with the different code. Now I want to try to implement some of this into the game World of Warcraft. Now I know on these forums "botting" is somewhat frowned upon, but I think it is a nice, easy way to start off and I am learning alot along the way.

Anyways, I am trying to make a Battle Grounds "bot" that:

1. Auto-joins BG

2. Runs a specific route in the BG

3. Runs another route if the character dies.

4. Repeats the process once out of the BG.

Here is what I have come up with so far. This a very rough idea:

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.0
; Author:         Andrew 
;
; Script Function: Auto-Join BG, Run around in BG, not go AFK
;   Template AutoIt script.
;
; ----------------------------------------------------------------------------

; Brings up WoW window
    WinActivate("World of Warcraft", "")
;   When you are at Battlemaster, it searches for a certain color, if it is there it joins the BG queue.
    $coord = PixelSearch(487,40,586,89, 0xB562FE, 10)
    If Not @error Then
        MouseClick( "right" , 604 , 510 , 10 , 10 )
    EndIf
;Here, I want it to start searching for new pixels when the above comes up as @error. This script indicates that you are in the BG, once it realizes this the movesments are executed.  
    $coord = PixelSearch(402,44,506,109, 0x4B52FF, 10)
        If Not @error Then
        Opt("SendKeyDownDelay", 1500)
        Send( "{UP}")
        Opt("SendKeyDownDelay", 500)
        Send( "{RIGHT}")
        Opt("SendKeyDownDelay", 1500)
        Send( "{UP}")
        Opt("SendKeyDownDelay", 500)
        Send( "{LEFT}")
        Opt("SendKeyDownDelay", 10000)
        Send( "{UP}")
    EndIf
;I want this portion of the code to execute when the program detects the their are new pixels, which would be in the graveyard. 
    $coord = PixelSearch(483,55,576,147, 0x4E6E78, 10)
        If Not @error Then
            Sleep(10000)
        Opt("SendKeyDownDelay", 1500)
        Send( "{UP}")
        Opt("SendKeyDownDelay", 500)
        Send( "{RIGHT}")
        Opt("SendKeyDownDelay", 1500)
        Send( "{UP}")
        Opt("SendKeyDownDelay", 500)
        Send( "{LEFT}")
        Opt("SendKeyDownDelay", 10000)
        Send( "{UP}")
        EndIf

Ok basically, it opens up the wow window and searches an area of the pixels for a certain color. If this comes back without an error, then the character right clicks and joins the BG queue. I would like it to keep doing this (clicking on the battlemaster) until an error comes up, but I cannot figure out how, that is my first problem. Now if an error comes up, it will start the next part of the script which searches for another pixel color. If this comes out to be true, then the character is in the BG. Then a series of buttons is pressed to run a route throughout the BG. The next part of the code is for when the character dies. I do not now how to make it start searching for pixels so that it knows that it is in the graveyard. If I had the second part of the script repeat, wouldnt it eventually come up as an error and wouldnt run the first course? Well, if I can get it to somehow detect it is in the GY, then it will run another course. It will repeat this if it dies again, something else I cant figure out. Then after all of this it will eventually go back to the battle master, after the BG is over, and start the process all over again.

I have been using the search feature and reading the help file alot. There are just some things that I cannot seem to find. If anyone could help me out with this I would really appreciate it.

Thank you.

Andrew

EDIT: Screen Shots

This is the second pixel search (the black circled part is the part where it searches)

Posted Image

This is the frist pixel search. This is where the character will start

Posted Image

This is the graveyard picture where the third pixelsearch will be done

Posted Image

Edited by andrew01
Link to comment
Share on other sites

BG = Battleground

I have been looking at different loops, the only one I really understand is Do, Until.

So I guess I could do the first pixel scanning until an error comes up?

Then I could do the second pixel scanning until the third pixel scanning = true?

Link to comment
Share on other sites

andrew01 i need to tell you something... Warden leaved Diablo II, and secure WoW atm.. he bans everyone that uses "3rd party programs" as example: AutoIT

Thnks.

[quote name='AceLoc']I gots new sunglasses there cool.[/quote]

Link to comment
Share on other sites

I think I will take my chances with this one. I know quite a bit about WoW and Third-Party programs. I also know A TON of people who use autoit programs to prevent them from going AFK, none of them have been banned.

That being said I thank you for your concern and who knows, I might not even use this program but it is still a good learning experience.

Link to comment
Share on other sites

Ok, I tweaked with the script a little and came up with this:

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.0
; Author:         Andrew 
;
; Script Function: Auto-Join BG, Run around in BG, not go AFK
;   Template AutoIt script.
;
; ----------------------------------------------------------------------------

; Brings up WoW window
    WinActivate("World of Warcraft", "")
Func Enter_Bg()
    $coord = PixelSearch(487,40,586,89, 0xB562FE, 10)
    If Not @error Then
        MouseClick( "right" , 604 , 510 , 10 , 10 )
    Elseif @error Then 
    Func Bg_Start()
    EndIf
EndFunc 
    Func Bg_Start()
    $coord = PixelSearch(402,44,506,109, 0x4B52FF, 10)
        If Not @error Then
        Sleep(15000)
        Opt("SendKeyDownDelay", 1500)
        Send( "{UP}")
        Opt("SendKeyDownDelay", 500)
        Send( "{RIGHT}")
        Opt("SendKeyDownDelay", 1500)
        Send( "{UP}")
        Opt("SendKeyDownDelay", 500)
        Send( "{LEFT}")
        Opt("SendKeyDownDelay", 10000)
        Send( "{UP}")
    EndIf
    EndFunc
    Func Bg_Graveyard()
    $coord = PixelSearch(483,55,576,147, 0x4E6E78, 10)
        If Not @error Then
            Sleep(10000)
        Opt("SendKeyDownDelay", 1500)
        Send( "{UP}")
        Opt("SendKeyDownDelay", 500)
        Send( "{RIGHT}")
        Opt("SendKeyDownDelay", 1500)
        Send( "{UP}")
        Opt("SendKeyDownDelay", 500)
        Send( "{LEFT}")
        Opt("SendKeyDownDelay", 10000)
        Send( "{UP}")
    ElseIf @error Then
        Func Bg_Graveyard()
    ElseIf @error = 5 Then
        Func Enter_Bg()
    EndIf
    EndFunc
oÝ÷ Ù8^¢yr¦ºé¢²ØZ´µ©Þ®º+§"»§ÖÞq«¬zØ^éÜJÖ«µ¸!z·ºÚ"µÍ[ÙZYÜ[Q[È×ÔÝ

BQ[YoÝ÷ ÙÚ²z-«Þjw§uû§pî²Ü×Ûhé©®()í¢ØZµû§rب«m«ij»[ºØ­v¬Ûzkhmì(®H§©òéiN§À%²'zj+zØbajÒ¢éÝ¢ëb²Æ²"­jëh×6
Opt("SendKeyDownDelay", 10000)

To something big like 30,000 (which is 30 seconds)

It doesnt start hitting the key right away but wait 30 seconds then hits the key for 30 seconds.

Link to comment
Share on other sites

Ok, I tweaked with the script a little and came up with this:

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.0
; Author:         Andrew 
;
; Script Function: Auto-Join BG, Run around in BG, not go AFK
;   Template AutoIt script.
;
; ----------------------------------------------------------------------------

; Brings up WoW window
    WinActivate("World of Warcraft", "")
Func Enter_Bg()
    $coord = PixelSearch(487,40,586,89, 0xB562FE, 10)
    If Not @error Then
        MouseClick( "right" , 604 , 510 , 10 , 10 )
    Elseif @error Then 
    Func Bg_Start()
    EndIf
EndFunc 
    Func Bg_Start()
    $coord = PixelSearch(402,44,506,109, 0x4B52FF, 10)
        If Not @error Then
        Sleep(15000)
        Opt("SendKeyDownDelay", 1500)
        Send( "{UP}")
        Opt("SendKeyDownDelay", 500)
        Send( "{RIGHT}")
        Opt("SendKeyDownDelay", 1500)
        Send( "{UP}")
        Opt("SendKeyDownDelay", 500)
        Send( "{LEFT}")
        Opt("SendKeyDownDelay", 10000)
        Send( "{UP}")
    EndIf
    EndFunc
    Func Bg_Graveyard()
    $coord = PixelSearch(483,55,576,147, 0x4E6E78, 10)
        If Not @error Then
            Sleep(10000)
        Opt("SendKeyDownDelay", 1500)
        Send( "{UP}")
        Opt("SendKeyDownDelay", 500)
        Send( "{RIGHT}")
        Opt("SendKeyDownDelay", 1500)
        Send( "{UP}")
        Opt("SendKeyDownDelay", 500)
        Send( "{LEFT}")
        Opt("SendKeyDownDelay", 10000)
        Send( "{UP}")
    ElseIf @error Then
        Func Bg_Graveyard()
    ElseIf @error = 5 Then
        Func Enter_Bg()
    EndIf
    EndFunc
oÝ÷ Ù8^¢yr¦ºé¢²ØZ´µ©Þ®º+§"»§ÖÞq«¬zØ^éÜJÖ«µ¸!z·ºÚ"µÍ[ÙZYÜ[Q[È×ÔÝ

BQ[YoÝ÷ ÙÚ²z-«Þjw§uû§pî²Ü×Ûhé©®()í¢ØZµû§rب«m«ij»[ºØ­v¬Ûzkhmì(®H§©òéiN§À%²'zj+zØbajÒ¢éÝ¢ëb²Æ²"­jëh×6
Opt("SendKeyDownDelay", 10000)
oÝ÷ Ù:,¢g­)àn(%G·ÓM4Â+7ÒÇ¢wl"×hzÉí²Ö«¶­¶)ඤ{*âZÁ¬ºÜÝô±ç(Û-éáÛ-éÉú+ßKrݳú®¢×¢¶ÈhºW[zÊ&zØb  bëaÆ®¶­sdbW'&÷"FVà¤&uõ7F'B²7F'G2gVæ0£¶÷FW"à

-Ace Loc.

[quote name='AceLoc']I gots new sunglasses there cool.[/quote]

Link to comment
Share on other sites

This 'may' work for the error number thing

While 1 ;Start infinite loop
$err = 0 ;$err will count how many errors you have, starting at 0
'thingy that may have an error' ; <-- That would be the part that might result in an error
If @error then ; <-- If theres an error then do the next line
$err = $err + 1 ; Raises the $err if there is an error
If $err = #of errors Then ; exchange # with the error limit, at which point it stops trying.
Exit (Or exitloop, to go to the next part regardless) ; exit quits the program, exitloop goes to the next section of ;code after the 'WEnd'
EndIf
WEnd ; finishes the loop, If exitloop is chosen, anything following that line will be executed
Edited by Jasio
Link to comment
Share on other sites

Awesome, thanks for the fast reply, I am going to try that out right now. It looks like it should work.

EDIT: This is what I am going to try out:

Func Bg_Start()
    While 1
        $err = 0
    $coord = PixelSearch(33,159,326,519, 0x06B4FF, 100)
        If Not @error Then
        Sleep(15000)
        Opt("SendKeyDownDelay", 1500)
        Send( "{UP}")
        Opt("SendKeyDownDelay", 500)
        Send( "{RIGHT}")
        Opt("SendKeyDownDelay", 1500)
        Send( "{UP}")
        Opt("SendKeyDownDelay", 500)
        Send( "{LEFT}")
        Opt("SendKeyDownDelay", 10000)
        Send( "{UP}")
    ElseIf @error Then
        $err = $err + 1
        If $err = 10 Then
            Enter_Bg()
        EndIf
        WEnd
Edited by andrew01
Link to comment
Share on other sites

I am starting to have some really wierd errors now like it will Say this "If" statement does not have an EndIf statement and then say:Wend. Or this Func does not have an end func (when it really does)

Could anyone test this to see if they get errors

WinActivate("World of Warcraft", "")
    Enter_Bg()
    Func Enter_Bg()
    $coord = PixelSearch(487,40,586,89, 0xB562FE, 3)
    If Not @error Then
    Do  
        Opt("MouseClickDelay", 60000)
        MouseClick( "right" , 604 , 510 , 1 , 100 )
    Until @error
    Elseif @error Then 
    Bg_Start()
    EndIf
    EndFunc 
    
    Bg_Start()
    Func Bg_Start()
    $coord = PixelSearch(33,159,326,519, 0x06B4FF, 100)
        If Not @error Then
        Sleep(15000)
        Opt("SendKeyDownDelay", 1500)
        Send( "{UP}")
        Opt("SendKeyDownDelay", 500)
        Send( "{RIGHT}")
        Opt("SendKeyDownDelay", 1500)
        Send( "{UP}")
        Opt("SendKeyDownDelay", 500)
        Send( "{LEFT}")
        Opt("SendKeyDownDelay", 10000)
        Send( "{UP}")
        
        
     Bg_Graveyard()
    Func Bg_Graveyard()
        While 1
            $err = 0
        $coord = PixelSearch(483,55,576,147, 0x4E6E78, 10)
        If Not @error Then
            Sleep(10000)
        Opt("SendKeyDownDelay", 1500)
        Send( "{UP}")
        Opt("SendKeyDownDelay", 500)
        Send( "{RIGHT}")
        Opt("SendKeyDownDelay", 1500)
        Send( "{UP}")
        Opt("SendKeyDownDelay", 500)
        Send( "{LEFT}")
        Opt("SendKeyDownDelay", 10000)
        Send( "{UP}")
    If @error Then
        $err = $err + 1
        If $err = 10 Then
            Enter_Bg()
        EndIf
        WEnd
    EndFunc

EDIT: Now its coming up with weird stuff like this "==> "If" statement has no matching "EndIf" statement.:

EndIf "

This is REALLY confusing me now?? :)

Edited by andrew01
Link to comment
Share on other sites

  • Moderators

Just a quick glance, the 2nd to last "If" statement on the end in the function, doesn' have an EndIf before or after the WEnd (before is correct).

Edited by SmOke_N

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

Thank you for the reply Smoke_N, I overlooked that. Now though, some else wierd is happening, it sort of makes me think the code is "bugged" or something.

While 1
        $err = 0
    $coord = PixelSearch(483,55,576,147, 0x4E6E78, 10)
    If Not @error Then
    Sleep(10000)
        Opt("SendKeyDownDelay", 1500)
        Send( "{UP}")
        Opt("SendKeyDownDelay", 500)
        Send( "{RIGHT}")
        Opt("SendKeyDownDelay", 1500)
        Send( "{UP}")
        Opt("SendKeyDownDelay", 500)
        Send( "{LEFT}")
        Opt("SendKeyDownDelay", 10000)
        Send( "{UP}")
    If @error Then
        $err = $err + 1
        If $err = 10 Then
            Enter_Bg()
        EndIf
    EndIf
    WEnd
oÝ÷ ØZ+{¦¦WnÞ!òuÕÛh¶¥jËew¨~Ø^r^¶¬zºè­Ê&zË©r^ç
Link to comment
Share on other sites

  • Moderators

Count how many "If"'s you have, then count how many "EndIf"'s you have... you'll understand.

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

Thank you for the reply Smoke_N, I overlooked that. Now though, some else wierd is happening, it sort of makes me think the code is "bugged" or something.

While 1
        $err = 0
    $coord = PixelSearch(483,55,576,147, 0x4E6E78, 10)
    If Not @error Then
    Sleep(10000)
        Opt("SendKeyDownDelay", 1500)
        Send( "{UP}")
        Opt("SendKeyDownDelay", 500)
        Send( "{RIGHT}")
        Opt("SendKeyDownDelay", 1500)
        Send( "{UP}")
        Opt("SendKeyDownDelay", 500)
        Send( "{LEFT}")
        Opt("SendKeyDownDelay", 10000)
        Send( "{UP}")
    If @error Then
        $err = $err + 1
        If $err = 10 Then
            Enter_Bg()
        EndIf
    EndIf
    WEnd
oÝ÷ ØZ+{¦¦WnÞ!òuÕÛh¶¥jËew¨~Ø^r^¶¬zºè­Ê&zË©r^çoÝ÷ Ûú®¢×¨º·è®f­¶)à~âקµ8Ë
.×h¶¬~ò¢è§IÈ©ÝʬyëazènW¦jëh×6  While 1
        $err = 0
        $coord = PixelSearch(483,55,576,147, 0x4E6E78, 10)
        If Not @error Then
            Sleep(10000)
            Opt("SendKeyDownDelay", 1500)
            Send( "{UP}")
            Opt("SendKeyDownDelay", 500)
            Send( "{RIGHT}")
            Opt("SendKeyDownDelay", 1500)
            Send( "{UP}")
            Opt("SendKeyDownDelay", 500)
            Send( "{LEFT}")
            Opt("SendKeyDownDelay", 10000)
            Send( "{UP}")
            If @error Then
                $err = $err + 1
                If $err = 10 Then
                    Enter_Bg()
                EndIf
            EndIf
        ; <== Where's the EndIf here?
    WEnd

The errors are a little confusing. You are missing an EndIf, but the error says you are missing WEnd. That's because the interpreter lost track of the levels involved. Use Ctrl-T for Tidy in SciTE to catch this and get automatic indent to help you track it down.

:)

(Edit: Mixing multiple spaces and hard tabs for indenting also makes it display funky, increasing likelyhood of errors.)

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

I was wondering If I just have a script like this

BG_Start
Func BG_Start()
Opt("SendKeyDownDelay", 1500)
Send( "{UP}")
Opt("SendKeyDownDelay", 500)
Send( "{LEFT}")
Opt("SendKeyDownDelay", 10000)
Send( "{UP}")
Bg_Graveyard()
EndFunc

Will Auto-It do all of those things in order automatically including the "Bg_Graveyard()" at the end?

Thanks.

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