Sign in to follow this  
Followers 0
CodeMaster Rapture

Improving upon old bots (WoW Fishing)

2 posts in this topic

Greetings,

I've been playing WoW since launch and have made numerous scripts, LUA AddOns, and various other forms of code to make my gaming easier (carpel tunnel sux). So, today I'd like to discuss the various forms of Fishing bots. With the recent changes in game to the profession (20 sec timer, and guaranteed splash) I think some better code is in order.

The history of the World of Warcraft fishing bot extends back to the beta days with AutoHotkey (yuck) and also a Linux version in C for those using VMWare. These two versions were primative and prone to errors. The basic logic was as follows:

While 1
     $coords = PixelSearchFunction(x1,y1,x2,y2,$color)
     If (IsArray($coords)) Then
          MouseClick("right")
          Sleep(1000)
          MouseClick("right")
     EndIf
WEnd

As you can see, there was very little to the script/app. The Linux version had some proprietary functions for pixel searching, but all in all it was the same. Just before WoW was launched to the public, someone wrote a little more robust bot that had some better error checking (is the game open/active) and allowed for the programmer to adjust the search parameters a little.

Just after I started playing WoW, I began coding a fishing bot in C++ and then came across AutoIt which made my life so much easier from then on (Thanx Jon!). So I wrote my version of the bot using a better and faster method of fishing.

HotKeySet("{PAUSE}","_TogglePause")
HotKeySet("+z","_Quit")
HotKeySet("+r","_Reset")

;Search Parameters:
Global Const $hex_Bauber_Color = 0x354868
Global Const $hex_Splash_Color = 0xF6F6F6
Global Const $int_Shade = 10
Global Const $int_X_Offset = 50
Global Const $int_Y_Offset = 25
Global Const $pos_TopLeft[2] = [215,545]
Global Const $pos_BottomRight[2] = [1000,700]

;Misc variables:
Global $bln_Paused = True
Global $bln_LookingForBauber = True
Global $int_Timer = TimerInit()

While 1
    If (WinActive("World of Warcraft")) Then
        Local $pos_Bauber, $pos_Splash
        If (Not $bln_Paused) Then
            If (TimerDiff($int_Timer) < 30000) Then
                If ($bln_LookingForBauber) Then
                    ;Find the bauber (Big search area)
                    $pos_Bauber = PixelSearch($pos_TopLeft[0],$pos_TopLeft[1],$pos_BottomRight[0],$pos_BottomRight[1],$hex_Bauber_Color,$int_Shade)
                    If (not @error) Then
                        MouseMove($pos_Bauber[0],$pos_Bauber[1],0)
                        $bln_LookingForBauber = False
                    EndIf
                Else
                    ;Search around the bauber for the splash (small search area)
                    $pos_Splash = PixelSearch($pos_Bauber[0]-$int_X_Offset,$pos_Bauber[1]-$int_Y_Offset,$pos_Bauber[0]+$int_X_Offset,$pos_Bauber[1]+$int_Y_Offset,$hex_Splash_Color,$int_Shade)
                    If (Not @error) Then
                        MouseClick("right") ;Loot the fish
                        Sleep(2500)         ;Wait for old Bauber to fade
                        _Reset()            ;Recast
                    EndIf
                EndIf
            Else
                ;Timeout
                _Reset()
            EndIf
        EndIf
    EndIf
    Sleep(10)
WEnd

Func _Reset()
    $int_Timer = TimerInit()
    $bln_LookingForBauber = True
    Send("3")
EndFunc
    
Func _TogglePause()
    $bln_Paused = Not $bln_Paused
EndFunc

Func _Quit()
    Exit
EndFunc

Later I added some code to search a specific aspect of the screen (roughly 75% width and 48% height) based off of the client screen area which made things more adaptable to various screen resolutions. I also added some code to set the user's camera to first person view for optimal accuracy as well as auto adjusting the search colors based off of the time and location (used some OCR code from another poster here).

I recently lost my fancy script due to a hard drive failure and I'm having to rewrite it. Now I'm pondering if there is a better method (less CPU intensive and more accurate). I've toyed with the idea of using checksums to search for the "splash" of the bauber, but I couldn't come up with a viable alternative. I was wondering if anyone has tried a different approach to this problem. I think the best approach overall is to somehow detect the sound the game plays for the splash, but I can't find anything useful on the forums.

In any event, this is my method and I'm up for ideas for a better one.

-CMR

Share this post


Link to post
Share on other sites



This is old, very simplistic, and I don't know if it still works but it might get you on the right track:

; AutoIt Version: 3.0
; Language:       English
; Platform:       WinXP
; Author:         Mibz (Pantless Krab)
;
; Script Function:
;   WoW FishBot.
;
; Wow Window Title - World of Warcraft
; WoW Window Size - w1032 x h795
; classname=GxWindowClassD3d
; Colour of splash - 0xA2A67D
;         0xC1AD7A
;         0xD0C08D
; Position of item -       x:44  y:226
; Position of hotkey 0 -     x:409 y:768


; Prompt the user to run the script using Yes/No prompt
$run = MsgBox(4, "FishBot", "Do you want to run FishBot?")


; Exit if "No"
If $run = 7 Then
    Exit
EndIf

; Initial shit
$time = MsgBox(4, "FishBot - Time of Day?", "Yes = Day | No = Night")
WinActivate("World of Warcraft")
HotKeySet("{PAUSE}", "EndScript")

; Script Start
While 1
  MouseClick("left", 409, 768, 1, 2)
  MouseMove(500, 500)
  $start = TimerInit()
  $dif = TimerDiff($start)
  While 1
    If $time = 6 Then
      $coord = PixelSearch (5, 300, 1024, 560, 0xF6F6F6, 30, 4)
    Else
      $coord = PixelSearch (5, 300, 1024, 560, 0xEEEEEE, 55, 3)
    EndIf

; 5, 300 - 1024, 560 can be changed if you want to search a wider area.
; Not recommended though since you can just adjust your view to fit all
; the water in that space. The bigger the area, the less likely it is to
; detect it.
; If the splash isn't getting detected then change the hex colour to
; something a bit closer. Top one is day, bottom is night.

    If UBound($coord)>1 Then
      MouseClick("right", $coord[0], $coord[1], 1, 3)
      Sleep(500)
      MouseClick("right", 44, 226, 1, 5)
      ExitLoop
    Else
      Sleep(250)
      $dif = TimerDiff($start)
      If $dif > 30000 Then
        ExitLoop
      EndIf
    EndIf
  WEnd
WEnd
   
 
; Function to exit script
Func EndScript()
  $exit = MsgBox(4, "FishBot", "End FishBot?")
  If $exit = 6 Then
    Exit
  EndIf
EndFunc

A little reading goes a long way. Post count means nothing.

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