Sign in to follow this  
Followers 0
MagnumXL

WoW Fishbot

10 posts in this topic

#1 ·  Posted (edited)

Feeling decidedly unchallenged I decided to make my own wow fishbot. I just put this together this morning. There are all kinds of features and error controls that could be emplemented. Please offer criticism but I'm just putting this up as a "Proof of Concept" to contribute to the community what little I can. I'm sure their are better easier ways but i couldn't find any that work "out of the box", this one should. I only tested it twice... about 10 casts each time, caught 100%.

#include <GUIConstants.au3>
#Include <Misc.au3>
HotKeySet("{ESC}","QuitIt");Stop bot at any time.
If WinExists("World of Warcraft") = 0 Then Exit
$dll = DllOpen("user32.dll");Apparently speeds up _IsPressed detection?
$ttx = @DesktopWidth/2;Set the tooltips will appear.
$tty = @DesktopHeight*.8;"
;////////// FIND COLOR ///////////;
$gui = GUICreate("",200,200,(@DesktopWidth/2)-100,@DesktopHeight-200,$WS_POPUP,$WS_EX_TOPMOST);Create a large borderless gui that is always on top so user can see color.
GUISetState(@SW_SHOW)

While -1
    If WinActive("World of Warcraft") = 0 Then WinActivate("World of Warcraft");Make sure Wow stays active while user is selecting color.
    $mouse = MouseGetPos()
    $color = PixelGetColor($mouse[0]-75,$mouse[1]-75)
    ToolTip("<--- Left Click to select this color.",$mouse[0]-75,$mouse[1]-83);Create Tooltip away from cursor that user can use to select color, mousing over bobber changes its color!
    GUISetBkColor("0x" & Hex($color,6),$gui);Update gui with color seen.
    If _IsPressed("01",$dll) Then ExitLoop;Exit loop with $color when user left clicks.
WEnd
ToolTip("Color Selected, Thank you!",$ttx,$tty,"",2)
Sleep(500)
GUISetState(@SW_HIDE);Gui for selecting color no longer needed.
;////////////////////////////////;

;////////// PREPARE TO BOT! //////////;
ToolTip('Waiting for "Right Click" (catch this one)',$ttx,$tty,"",2)
While _IsPressed("02",$dll) = 0;Wait till user right clicks to catch the color test fish before actually starting botting.
    Sleep(1)
Wend
DllClose($dll);Dll for detecting mouse clicks is no longer needed.
Sleep(500)
ToolTip("Initializing Fishing... (4 secs)",$ttx,$tty,"",2)
Sleep(2000);Give game plenty of time to autoloot the color test fish.
ToolTip("Entering Main Fishing (you can semi-AFK now)",$ttx,$tty,"",2)
Sleep(2000);"
;/////////////////////////////////////;

;/////////// BOT /////////////////////;
While -1
    ToolTip("Sending ALT+1 (fish)",$ttx,$tty,"",2)
    Sleep(1000)
    Send("!1");Start WoW fishing using ALT+1
    ToolTip("Waiting for Bobber to Deploy",$ttx,$tty,"",2)
    Sleep(2000)
    $timer = TimerInit();Set a timeout for finding bobber.
    While -1
        ToolTip("Searching for Bobber... ",$ttx,$tty,"",2)
        $bobber = PixelSearch(@DesktopWidth*.25,@DesktopHeight*.2,@DesktopWidth*.75,@DesktopHeight*.8,"0x" & Hex($color,6),8,1);Look for user selected color in a large area in the center of the screen
        If @error <> 1 Then ExitLoop;When color is found bail outta loop to start looking for splash.
        If TimerDiff($timer) > 20000 Then 
            MsgBox(48,"Failure","Bobber not found. Exiting.")
            Exit
        EndIf
    Wend
    $timer = TimerInit();Set a timeout for finding splash.
    While -1
        ToolTip("Searching for Splash... ",$ttx,$tty,"",2)
        $splash = PixelSearch($bobber[0]-5,$bobber[1]-5,$bobber[0]+5,$bobber[1]+5,"0x" & Hex($color,6),8,1);search a tiny 10x10 sqaure for users color. 
        If @error = 1 Then ExitLoop; When color not found the bobber just bobbed (Splash Detected!)
        If TimerDiff($timer) > 20000 Then 
            MsgBox(48,"Failure","Splash not found. Exiting.")
            Exit
        EndIf
    Wend
    ToolTip("Splash Detected!",$ttx,$tty,"",2)
    Sleep(Random(5,200))
    MouseClick("Right", $bobber[0],$bobber[1],1,0)
    Sleep(1000)
    ToolTip("Waiting 4 seconds to fish again",$ttx,$tty,"",2)
    SLeep(4000)
Wend
Exit
;//////////////////////////////////;

;//////////// QUIT FUNC //////////;
Func QuitIt()
    Exit
EndFunc
;/////////////////////////////////;

I think I have it commented fairly thouroughly, if not the "Tooltips" should give even more of a clue.

-edited to clean up code some.

Edited by MagnumXL

Share this post


Link to post
Share on other sites



looks cool, i figured most of it out like putting my fishing to alt+1 commmand and such, but how does this actually work? I run the script, then i fish. then i select the bobber, and then i right click when it splashes.

am i doing something wrong?

thanks! this is great i just wish i can get it working :)

Share this post


Link to post
Share on other sites

looks cool, i figured most of it out like putting my fishing to alt+1 commmand and such, but how does this actually work? I run the script, then i fish. then i select the bobber, and then i right click when it splashes.

am i doing something wrong?

thanks! this is great i just wish i can get it working :D

I am interested too! Can we see a fix or update to this?

Share this post


Link to post
Share on other sites

I am interested too! Can we see a fix or update to this?

Fishbots are a great way to start learning autoit... here is the one i used to use to catch only stonescales or 'non junk' fish :D

obviously this wouldn't work for you out of the box because the mouse cordinates for your loot window would be different but its rather well commented and should give you something you can tinker with...

; ****************************************************************************************************

****
; ZhenFisher
; ~ Will attempt to find bobber for 5 seconds else recast
; ~ will attempt to only loot a single type of fish

; Globals
$title = "ZhenFisher"
$win_title = "World of Warcraft"

$top_border_height = 23
$left_border_width = 4

$screen_width = 800
$screen_height = 600

$time_to_wait = 30000
$time_for_bobber = 4500
$time_for_loot = 1000
$time_for_trans = 600000

dim $trans_time
dim $start_time
dim $bobber_time
dim $search_loot_time
; ****************************************************************************************************

****
; Hot Keys
HotKeySet("{PAUSE}", "request_end")

; ****************************************************************************************************

****
if not WinExists($win_title, "") then
    msg($win_title & " window must be open.")
    Exit
endif

WinActivate($win_title, "")
WinSetOnTop($win_title, "", 0)
Sleep(500)

check_window()

$win_pos = WinGetPos($win_title, "")
$win_x = $win_pos[0] + $left_border_width
$win_y = $win_pos[1] + $top_border_height

$top = $win_y + (.25 * $screen_height)
$bottom = $top + (.35 * $screen_height) - 1
$left = $win_x + (.15 * $screen_width)
$right = $left + $screen_width - (.15 * 2.0 * $screen_width) - 1

; Show a visual confirmation by making the mouse draw the area on the screen
; that will be used to scan for the bobber.
MouseMove($left, $top, 2)
MouseMove($right, $top, 2)
MouseMove($right, $bottom, 2)
MouseMove($left, $bottom, 2)

reset_trans_timer()
cast_pole()
find_float()

; ****************************************************************************************************

****
func find_float()
    Sleep(2500)
    $color_dark_purple = 0x463B4D
    $color_dark_blue = 0x283A64
    $color_red = 0xA72C0B
    $color_stormwind_daylight_blue = 0x2B3254
    $color_stormwind_daylight_red = 0x6B1F0C
    $color_beige = 0xBB9B3D
    $color_night_blue = 0x0B1931
    $color_bfd_darkshore_bobber = 0xA98863
    $color_bb_red = 0xCE4D24
    $color_feathermoon_red = 0x65340D
    $color_feathermoon_red_night = 0xCD4110
    $color_deadwind_red = 0x46281F
    $color_moonglade_dark_red = 0x002416
    $color_moonglade_black = 0x000505
    $color_moonglade_bobber = 0x004F3D
    $color_deviate_red = 0x461607
    $color_deviate_dark_red = 0x481C10
    $color_deviate_orangish_red = 0x5D1E08
    $color_stonebull_night_orangishred = 0xB14013
    $color_deviate_bobber = 0x67553F
   
   ; this is the color used to pixelsearch for the bobber. change the color to a good color
   ; on the bobber that is prominent on the screen
    $color_to_use = $color_feathermoon_red_night
   
   ; this is the search tolerance. In areas where the bobber colors really stand out, you can
   ; use a fairly high threshold. In areas where the bobber colors are fairly muted in with
   ; the background, you will have to lower the values considerably.
    $bobber_search_tolerance = 40

   ; it's better to use lower values here in favor of accurate searching. This will take more
   ; time for it to detect the bobber, but usually the splash doesn't occur until at least 30%
   ; of the time has run out, and by that time, it should have detected the bobber (assuming the
   ; color values and tolerance are correct).
    $bobber_search_step = 2
   
   ; Search for float. In certain lighting, the part of the float may look more purple than
   ; blue. In this case, using $color_red tends to work the best with a tolerance of 20.
    while 1
        if TimerDiff($trans_time) >= $time_for_trans then
        Sleep(30000)
        Send("2")
        Sleep(5000)

        MouseClick("left", 55, 415, 1, 2)
        Sleep(40000)
        Send("2")
        reset_trans_timer()
        endif

        if TimerDiff($bobber_time) >= $time_for_bobber then
            cast_pole()
        endif

        Sleep(1000)
        $pos = PixelSearch($left, $top, $right, $bottom, $color_to_use, $bobber_search_tolerance, $bobber_search_step)
        if @error then
            SetError(0)
        else
            MouseMove($pos[0], $pos[1], 2)
            find_splash($pos[0], $pos[1] )
        endif
        Sleep(10)
    wend
endfunc

; ****************************************************************************************************

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

   ; Usually you do not have to modify the search color for the splash, as the pixels
   ; have a very distinctive, bright color.
   ; Default white: 0xF6F6F6
   ; Moonglade Pure WHite: 0xCCFFFF 0xDCFFFF
    $splash_color = 0xDCFFFF

   ; Sometimes 30 tolerance works well, sometimes 20 is better in lit areas to avoid catching highlights
   ; in other things.
    $splash_tolerance = 30
   
   ; The search step can be pretty small here (1 to 3) without worries because the search area is
   ; so small once it has been narrowed down - speed isn't much of an issue.
    $splash_search_step = 1

   ; Search for splash
    while TimerDiff($start_time) < $time_to_wait
        $pos = PixelSearch($search_left, $search_top, $search_right, $search_bottom, $splash_color, $splash_tolerance, $splash_search_step)
        if @error then
            SetError(0)
        else
           ; Click on the splash
            Sleep(250)
            MouseClick("right", $pos[0], $pos[1], 1, 2)


           ; Click on the loot
           ; $mouse_pos = MouseGetPos()
           
            Sleep(1200)
           ; MouseClick("left", 40, 160, 1, 2)
        verify_loot_1()
        verify_loot_2()
        verify_loot_3()
        verify_loot_4()

            Sleep(3200)
            ExitLoop
        endif
        Sleep(100)
    wend
   
   ; Cast pole and start all over again.
    Sleep(1200)
   ; MouseClick("left", 40, 160, 1, 2)
    cast_pole()
endfunc
; ****************************************************************************************************

****
func verify_loot_1()
    $search_loot_time = TimerInit()

    $verify_left = 40 - 32
    $verify_right = $verify_left + 52
    $verify_top = 160 - 32
    $verify_bottom = $verify_top + 64
    $verify_tolerance = 5
    $verify_search_step = 1

    $color_stonescale = 0x9BA54F
    $color_squid = 0xC162C7
    $color_fire = 0xF7F739
    $color_might = 0x1CB895

    $verify_color = $color_stonescale
    
   ; Search for splash
    while TimerDiff($search_loot_time) < $time_for_loot
        $pos = PixelSearch($verify_left, $verify_top, $verify_right, $verify_bottom, $verify_color, $verify_tolerance, $verify_search_step)
        if @error then
            SetError(0)
        else
           ; Click on the Loot
        MouseClick("left", 40, 160, 1, 2)
            Sleep(3200)
            ExitLoop
        endif
        Sleep(100)
    wend
endfunc
; ****************************************************************************************************

****
func verify_loot_2()
    $search_loot_time = TimerInit()

    $verify_left = 40 - 32
    $verify_right = $verify_left + 52
    $verify_top = 160 - 32
    $verify_bottom = $verify_top + 64
    $verify_tolerance = 5
    $verify_search_step = 1

    $color_stonescale = 0x9BA54F
    $color_squid = 0xC162C7
    $color_fire = 0xF7F739
    $color_might = 0x1CB895
    $color_summerbass = 0xC1A61B

    $verify_color = $color_summerbass
    
   ; Search for splash
    while TimerDiff($search_loot_time) < $time_for_loot
        $pos = PixelSearch($verify_left, $verify_top, $verify_right, $verify_bottom, $verify_color, $verify_tolerance, $verify_search_step)
        if @error then
            SetError(0)
        else
           ; Click on the Loot
        MouseClick("left", 40, 160, 1, 2)
            Sleep(3200)
            ExitLoop
        endif
        Sleep(100)
    wend
endfunc
; ****************************************************************************************************

****
func verify_loot_3()
    $search_loot_time = TimerInit()

    $verify_left = 40 - 32
    $verify_right = $verify_left + 52
    $verify_top = 160 - 32
    $verify_bottom = $verify_top + 64
    $verify_tolerance = 5
    $verify_search_step = 1

    $color_stonescale = 0x9BA54F
    $color_squid = 0xC162C7
    $color_fire = 0xF7F739
    $color_might = 0x1CB895

    $verify_color = $color_fire
    
   ; Search for splash
    while TimerDiff($search_loot_time) < $time_for_loot
        $pos = PixelSearch($verify_left, $verify_top, $verify_right, $verify_bottom, $verify_color, $verify_tolerance, $verify_search_step)
        if @error then
            SetError(0)
        else
           ; Click on the Loot
        MouseClick("left", 40, 160, 1, 2)
            Sleep(3200)
            ExitLoop
        endif
        Sleep(100)
    wend
endfunc
; ****************************************************************************************************

****
func verify_loot_4()
    $search_loot_time = TimerInit()

    $verify_left = 40 - 32
    $verify_right = $verify_left + 52
    $verify_top = 160 - 32
    $verify_bottom = $verify_top + 64
    $verify_tolerance = 5
    $verify_search_step = 1

    $color_stonescale = 0x9BA54F
    $color_squid = 0xC162C7
    $color_fire = 0xF7F739
    $color_might = 0x1CB895

    $verify_color = $color_might
    
   ; Search for splash
    while TimerDiff($search_loot_time) < $time_for_loot
        $pos = PixelSearch($verify_left, $verify_top, $verify_right, $verify_bottom, $verify_color, $verify_tolerance, $verify_search_step)
        if @error then
            SetError(0)
        else
           ; Click on the Loot
        MouseClick("left", 40, 160, 1, 2)
            Sleep(3200)
            ExitLoop
        endif
        Sleep(100)
    wend
endfunc
; ****************************************************************************************************

****
func cast_pole()
    $start_time = TimerInit()
    $bobber_time = TimerInit()
    Send("1")
    Sleep(2000)
endfunc

; ****************************************************************************************************

****
func reset_trans_timer()
    $trans_time = TimerInit()
endfunc

; ****************************************************************************************************

****
func check_window()
    $dimensions = WinGetClientSize($win_title, "")
    if $dimensions[0] <> $screen_width or $dimensions[1] <> $screen_height then
        msg("Invalid window size. You must use " & $screen_width & "x" & $screen_height & " resolution in window mode.")
        Exit
    endif
endfunc

; ****************************************************************************************************

****
func msg($text)
    MsgBox(0, $title, $text)
endfunc

; ****************************************************************************************************

****
func msg_array($title, $array, $num_elements)
    dim $text
    $text = $array[0]

    for $j = 1 to $num_elements - 1
        $text = $text & ", " & $array[$j]
    next

    MsgBox(0, $title, $text)
endfunc

; ****************************************************************************************************

****
func request_end()
    $MB_YESNO = 4
    $MB_YES = 6
   
    if MsgBox($MB_YESNO, $title, "End script?") == $MB_YES then
        Exit
    endif
endfunc

; ****************************************************************************************************

****
func drain_timer()
    Msg("Restart")
    $start_time = $start_time - $time_to_wait
endfunc

; ****************************************************************************************************

****

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

Share this post


Link to post
Share on other sites

Yeah i will throw my update for this up. I had written a "help" file but cant seem to find it anywhere. Basically:

Have your pole equipped

Have your fishing set to Alt+1

be logged into wow and at the spot you want to fish

be zoomed all the way in so you dont see your chacter anymore

have any mods that show up in the center of the screen disabled

start the script - it will switch to wow

- Press Alt+1 to start fishing

- When the bobber appears place the arrow on the tooltip on the red feather so you see a nice red color in the box at the bottom of the screen

- Left Click to store that color

- wait till the bobber splashes and Right Click (Catch this one)

The script should take over and autofish for you.

Note: after a long period of time the lighting of the game will change. when it does you may "lose" the bobber color and have to re-select it.

I dont reccomend or condone afk botting.

I'll get my updated script up in a few...

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I quess a couple of new features would be:

- If there is an error it will just try again with the same color after showing you the msgbox for 5 seconds.

- I think maybe in the original the mouse stayed where you last clicked, now it gets over to the right side of the screen.

- Also the search area for the splash is now larger, maybe a touch to large. but its 20 pixels instead of the 10 that the comment would lead you to believe.

Anyway, here it is...

#include <GUIConstants.au3>
#Include <Misc.au3>
HotKeySet("{ESC}","QuitIt");Stop bot at any time.
If WinExists("World of Warcraft") = 0 Then Exit
$dll = DllOpen("user32.dll");Apparently speeds up _IsPressed detection?
$ttx = @DesktopWidth/2;Set the tooltips will appear.
$tty = @DesktopHeight*.8;"
;////////// FIND COLOR ///////////;
$gui = GUICreate("",200,200,(@DesktopWidth/2)-100,@DesktopHeight-200,$WS_POPUP,$WS_EX_TOPMOST);Create a large borderless gui that is always on top so user can see color.
GUISetState(@SW_SHOW)

While -1
    If WinActive("World of Warcraft") = 0 Then WinActivate("World of Warcraft");Make sure Wow stays active while user is selecting color.
    $mouse = MouseGetPos()
    $color = PixelGetColor($mouse[0]-75,$mouse[1]-75)
    ToolTip("<--- Left Click to select this color.",$mouse[0]-75,$mouse[1]-83);Create Tooltip away from cursor that user can use to select color, mousing over bobber changes its color!
    GUISetBkColor("0x" & Hex($color,6),$gui);Update gui with color seen.
    If _IsPressed("01",$dll) Then ExitLoop;Exit loop with $color when user left clicks.
WEnd
ToolTip("Color Selected, Thank you!",$ttx,$tty,"",2)
Sleep(500)
GUISetState(@SW_HIDE);Gui for selecting color no longer needed.
;////////////////////////////////;

;////////// PREPARE TO BOT! //////////;
ToolTip('Waiting for "Right Click" (catch this one)',$ttx,$tty,"",2)
While _IsPressed("02",$dll) = 0;Wait till user right clicks to catch the color test fish before actually starting botting.
    Sleep(1)
Wend
DllClose($dll);Dll for detecting mouse clicks is no longer needed.
Sleep(500)
ToolTip("Initializing Fishing... (4 secs)",$ttx,$tty,"",2)
Sleep(2000);Give game plenty of time to autoloot the color test fish.
ToolTip("Entering Main Fishing (you can semi-AFK now)",$ttx,$tty,"",2)
Sleep(2000);"
;/////////////////////////////////////;

;/////////// BOT /////////////////////;
While -1
    While -1
        ToolTip("Sending ALT+1 (fish)",$ttx,$tty,"",2)
        Sleep(1000)
        Send("!1");Start WoW fishing using ALT+1
        ToolTip("Waiting for Bobber to Deploy",$ttx,$tty,"",2)
        Sleep(2000)
        $timer = TimerInit();Set a timeout for finding bobber.
        While -1
            ToolTip("Searching for Bobber... ",$ttx,$tty,"",2)
            $bobber = PixelSearch(@DesktopWidth*.25,@DesktopHeight*.2,@DesktopWidth*.75,@DesktopHeight*.8,"0x" & Hex($color,6),8,1);Look for user selected color in a large area in the center of the screen
            If @error <> 1 Then ExitLoop;When color is found bail outta loop to start looking for splash.
            If TimerDiff($timer) > 20000 Then 
                MsgBox(48,"Failure","Bobber not found...",5)
                WinActivate("World of Warcraft")
                ExitLoop 2
            EndIf
        Wend
        $timer = TimerInit();Set a timeout for finding splash.
        While -1
            ToolTip("Searching for Splash... ",$ttx,$tty,"",2)
            $splash = PixelSearch($bobber[0]-10,$bobber[1]-10,$bobber[0]+10,$bobber[1]+10,"0x" & Hex($color,6),8,1);search a tiny 10x10 sqaure for users color. 
            If @error = 1 Then ExitLoop; When color not found the bobber just bobbed (Splash Detected!)
            If TimerDiff($timer) > 20000 Then 
                MsgBox(48,"Failure","Splash not found...",5)
                WinActivate("World of Warcraft")
                Exitloop 2
            EndIf
        Wend
        ToolTip("Splash Detected!",$ttx,$tty,"",2)
        Sleep(Random(5,500))
        MouseClick("Right", $bobber[0],$bobber[1],1,0)
        Sleep(2000)
        MouseMove(Random(1400,1665),Random(100,800),2)
        ToolTip("Waiting 4 seconds to fish again",$ttx,$tty,"",2)
        SLeep(4000)
    Wend
Wend
Exit
;//////////////////////////////////;

;//////////// QUIT FUNC //////////;
Func QuitIt()
    Exit
EndFunc
;/////////////////////////////////;
Edited by MagnumXL

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I created a fishbot for WoW a couple years ago and I just recently fixed it up a bit because one of the users was having problems, here it is; you'll find that it's pretty robust.

EDIT: Reading the readme is a must, it tells you have to use the bot.

Fishbot.zip

Edited by ame1011

[font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font]

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I had a lot of accuracy problems with your latest version, so I modified it a bit. I put an explanation dialog at the beginning, then a selection of the screen area to be scanned (so you don't have to try to position the camera a certain way).

I was missing 100% of casts with your last version, and only about 2% with this modified version.

BTW, I tested this with WoW in windowed mode, maximized, at 1680x1050. I'd like to know how well it works with other configurations.

Edit: OH! And I changed the exit key to {PAUSE}.

Edited by c0deWorm

My UDFs: ExitCodes

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Um i tried all the code suggested on this page but wasn't entirely impressed with any of them. Not that I can do any better. I'm just getting into programming so I couldn't do much with any of what is here at all. However probably 6 months ago I had a fishbot run off autoit that I believe was called "DT Fishbot".

I have not been able to find any script or executable. This was a wonderful fishbot in that it worked 99% of the time with no guidance whatsoever. Any help on someone who knows where i can find it? or something like it. I cant wait till I finish school and can write my own stuff more easily.

Edited by fozz

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