Jump to content

WoW fish bot


d0n
 Share

Recommended Posts

This code i found was working and all but i just didn't like to manually change the color of the bobber every time the day light changes so i wanted to add a pixel get function that when you "insert" you will capture the pixel of that spot and use it later.

I did not write this code, i just want to make this code better

at the moment after i click insert nothing would happen, it wouldn't move the mouse to the place of the bobber when i cast the fishing line again

;**********************************************************************
;*                                                                  *
;*                          Fishing Bot                          *
;*                       World of Warcraft                        *
;*                                                                  *
;**********************************************************************


;**********************************************************************
;*                    DEFINE GLOBAL VARIABLES                      *
;**********************************************************************
$title = "WOW FishBot"
$win_title = "World of Warcraft"

$top_border_height = 23
$left_border_width = 4

$scr_width = 1280
$scr_height = 800

$mouse = MouseGetPos()
$mouse_x = $mouse[0]
$mouse_y = $mouse[1]

$color_bobber = 0xA77E37      ;HEX code for bobber color.
$color_splash = 0xF6E8C1    ;HEX code for splash color.
$splash_tolerance = 18      ;Threshold for splash tolerance.
$bobber_search_tolerance = 15    ;Threshold for search tolerance.
$bobber_search_step = 2     ;Accuracy used for detection.
$splash_search_step = 1     ;Accuracy used for detection.

dim $start_time

;**********************************************************************
;*                        DEFINE HOTKEY(S)                        *
;**********************************************************************
HotKeySet ("{PAUSE}", "request_end")     ;"PAUSE" will cancel script.
HotKeySet ("{Insert}", "capture_pixel")  ;"Insert" will capture pixels.

;**********************************************************************
;*                 CHECK FOR RUNNING WOW PROGRAM                    *
;**********************************************************************
if NOT (WinExists ("World of Warcraft", "")) then
    msgbox (0, "World of Warcraft", "Please run World of Warcraft first, and then execute this file.")
    Exit
endif

;**********************************************************************
;*             WOW IS RUNNING, NOW MAKE ACTIVE WINDOW              *
;**********************************************************************
WinActivate ("World of Warcraft", "")
WinSetOnTop ("World of Warcraft", "", 0)
Sleep(5000)

;**********************************************************************
;*              VERIFY WINDOW FOR CORRECT RESOLUTION                *
;**********************************************************************
$dimensions = WinGetClientSize ("World of Warcraft", "")

if $dimensions[0] <> $scr_width or $dimensions[1] <> $scr_height then
    msgbox (0, "WoW FishBot", "Error - World of Warcraft is not running at the correct resolution.  Please change it to run at 800x600.")
    Exit
endif

;**********************************************************************
;*                      DEFINE SCANNING AREA                        *
;**********************************************************************
$win_pos = WinGetPos ("World of Warcraft", "")
$win_x = $win_pos[0] + $left_border_width
$win_y = $win_pos[1] + $top_border_height

$top = $win_y + (.20 * $scr_height)
$bottom = $top + (.50 * $scr_height) - 1
$left = $win_x + (.15 * $scr_width)
$right = $left + $scr_width - (.15 * 2.0 * $scr_width) - 1

;**********************************************************************
;*          DRAW RECTANGLE TO SHOW BOBBER SCANNING AREA          *
;**********************************************************************
MouseMove ($left, $top, 2)
MouseMove ($right, $top, 2)
MouseMove ($right, $bottom, 2)
MouseMove ($left, $bottom, 2)

;**********************************************************************
;*               PERFORM "CAST FISHING POLE" ACTION              *
;**********************************************************************
cast_pole()

;**********************************************************************
;*                   SEARCH FOR FISHING BOBBER                    *
;**********************************************************************
find_bobber()


;#################################################  #####################
;#                                                                  #
;#                      FUNCTION DEFINITIONS                        #
;#                                                                  #
;#################################################  #####################


;**********************************************************************
;* FUNCTION: find_bobber()                                           *
;*                                                                  *
;* This function will perform the  "scanning" of the screen to search *
;* for the actual fishing bobber.                                    *
;**********************************************************************
func find_bobber()

    while 1
        if TimerDiff ($start_time) >= 30000 then
            cast_pole()
        endif

        $pos = PixelSearch ($left, $top, $right, $bottom, _
            $color_bobber, $bobber_search_tolerance, _
            $bobber_search_step)

        if @error then
            SetError(0)

        else
            MouseMove ($pos[0], $pos[1])
            find_splash ($pos[0], $pos[1])

        endif

        Sleep(10)

    wend

endfunc

;**********************************************************************
;* FUNCTION: find_splash()                                          *
;*                                                                  *
;* This function will wait for the bobber to "splash".  Once this    *
;* occurs, the fish will be looted.                                *
;**********************************************************************
func find_splash ($float_x, $float_y)

    $search_left = $float_x - 32
    $search_right = $search_left + 52
    $search_top = $float_y - 32
    $search_bottom = $search_top + 64

    while TimerDiff($start_time) < 30000
        $pos = PixelSearch ($search_left, $search_top, $search_right, _
            $search_bottom, $color_splash, $splash_tolerance, _
            $splash_search_step)

        if @error then
            SetError(0)

        else
            MouseClick ("right")
            Sleep(100)
            Send("{SHIFTUP}")
            Sleep(3000)
            ExitLoop

        endif

        Sleep(10)

    wend

    cast_pole();Start the process all over now.

endfunc

;**********************************************************************
;* FUNCTION: cast_pole()                                              *
;*                                                                  *
;* This function will emulate the user pressing the "1" key, which  *
;* will in turn have his/her character begin the fishing process.    *
;**********************************************************************
func cast_pole()

    $start_time = TimerInit()

    Send ("1")
    Sleep(2000)

endfunc

;**********************************************************************
;* FUNCTION: request_end()                                          *
;*                                                                  *
;* This function is triggered when the user presses the "PAUSE"    *
;* button.  It will terminate the script.                            *
;**********************************************************************
func request_end()

    Exit

endfunc

;**********************************************************************
;* FUNCTION: capture_pixel()                                          *
;*                                                                  *
;* This function will capture the pixel of the bobber defined by      *
;* the user.                                                          *
;**********************************************************************

func capture_pixel()    

    $new_bobber = PixelGetColor ($mouse_x,$mouse_y)
    $color_bobber = ("0x" + (Hex($new_bobber, 6)))
    cast_pole()

endfunc
Edited by d0n
Link to comment
Share on other sites

i dont think its blizzard, i think i just messed up some where but i am not so good at this stuff lol

heheh i miss the good ole' WoW days... yah as of a few months ago mine all worked just fine - instead of resetting the colors i made scripts per region / location imo it was much less painful that way

just don't fish for hours in WC!! <_<

Don't let that status fool you, I am no advanced memeber!

Link to comment
Share on other sites

This code i found was working and all but i just didn't like to manually change the color of the bobber every time the day light changes so i wanted to add a pixel get function that when you "insert" you will capture the pixel of that spot and use it later.

I did not write this code, i just want to make this code better

at the moment after i click insert nothing would happen, it wouldn't move the mouse to the place of the bobber when i cast the fishing line again

That's because the bobber was not properly defined. You just trapped yourself in a circular logic. You want the script to automatically get the pixel color for the bobber, but in order for the script to find the bobber a color pixel must already be defined, but sice you don't want to "manually" define the color by clicking, thus it will never find the bobber.

[font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version

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