Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Rift Fishing Bot -simplistic-


  • Please log in to reply
258 replies to this topic
NotCoder
  • Members
  • 38 posts
  • Last active: Apr 21 2014 01:57 AM
  • Joined: 22 Jun 2012
--SCRIPT UPDATED 10/28/2012--

Well let's start by saying my knowledge of coding is limited so any suggestions or modifications are welcome.

After scouring the inernet for a decent "free" fishing bot that was only a fishing bot I was unable to find one so remembering AHK from a while back I decided to give it a go at my own little script for it.

This bot will:
Cast your line
Reel in to "Fight" the fish (even if multiple attempts are needed)
Recast your line if "You stop fishing" or "The fish gets away"
Restart if inactive for more than 30 seconds. (In case of interruption)
Reapply bait (If setup and bait is applied at beginning)

Some setup is necessary and/or you may need to customize the code according to your system.

Setup Required:

Verify and, if necessary, modify log file location (default game file location)
Attach pole to hotkey "-" in your in-game Hotbar
Set mouse coordinates for fishing location (change may not be necessary)

Set noncombat log file location (change may not be necessary)
Enable noncombat logging (type "/log" in in-game chat window)

Additional setup: (If baiting)

Apply bait to pole before starting script.
Attach preferred bait to hotkey "0" in your in-game Hotbar
Open bag containing pole -Must remain open while fishing- (in my example it is in the lower left corner of the screen)
Set mouse coordinates for fishing pole location (change may not be necessary)



This is the latest version of the original script.

I respesct and am very pleased that so many people are able to customize the script to their needs but please keep in mind that the intention of this script is to be as simple and self-explanatory as possible.

Please try to refrain from posting "personalized versions".


IfWinNotActive, RIFT, , WinActivate, RIFT,
WinWaitActive, RIFT,

Logfile = C:\Users\YourNameHere\My Documents\RIFT\log.txt ;Customize to personal Rift noncombat log file location.

fish :=0

top:
FileDelete, %logfile%
last_line :=0
sleep, 500
Send, -
sleep, 400
MouseClick, left,  876,  373 ;Customize mouse coordinate for pole click location.
Sleep, 200

If fish = 1
	 goto bait

go:
Timer := A_TickCount
Go-Loop:
{
Loop, read, %logfile%
	last_line := A_LoopReadLine
{
sleep, 200
	IfInString, last_line, lure has decayed
fish :=1
	IfInString, last_line, Reel
goto reel
	IfInString, last_line, away
goto top
	IfInString, last_line, stop fishing
goto top
	IfInString, last_line, received
goto top
	If A_TickCount - Timer < 30000
				 Goto, Go-Loop
Goto, top
}
}

reel:
Loop
{
FileDelete, %logfile%
last_line :=0
sleep, 200
Send, -
goto go
}

bait:
Loop
{
fish :=0
sleep, 200
Send, 0
sleep, 200
MouseClick, left,  1601,  883 ;Customize mouse coordinate for pole click location.
sleep, 4000
Reload
}

\::Goto, bait
[::Pause
]::Reload
Escape::ExitApp


NotCoder
  • Members
  • 38 posts
  • Last active: Apr 21 2014 01:57 AM
  • Joined: 22 Jun 2012
I have modified the script and it will now automatically re-bait. Will post new code after testing

NotCoder
  • Members
  • 38 posts
  • Last active: Apr 21 2014 01:57 AM
  • Joined: 22 Jun 2012
All old requirements stand

New Bot Assumptions:
Preferred bait is set to Hotkey "0"
Preferred bait Lasts for 10 charges. (see code for note on reassinging charge count)
bag is open with fishing pole at Mouse location 1601, 883

please see below for updated script


Rifter
  • Guests
  • Last active:
  • Joined: --
I just want you to know, you are my hero Notcoder. This is beyond amazing and I was always apprehensive about other programs; not knowing if they were hiding malicious content. This is a God send! I appreciate the time and effort that went into this, I would assume it wasn't an easy task.

Two thumbs way up!

emerge
  • Members
  • 6 posts
  • Last active: Feb 20 2013 01:24 AM
  • Joined: 28 Jun 2012
Hey coder, I am trying to run this macro. It casts for me, but does not reel in the fish or loop. What am I missing? I'm using the first script btw.

  • Guests
  • Last active:
  • Joined: --
@Emerge; Make sure you type /log in Rift and check that it says "Noncombat log has been enabled" before you run the script. I make that mistake often, you will have to turn it back on every game restart and possibly every relog.

@NotCoder; 2 questions. I seem to occasionally have latency hickups that are so severe a fish is missed and the loop gets cut. This problem is entirely on my end and not a code issue, but I was wondering if there was a way to add something to the affect of "if loot is not revived over course of 45seconds auto use key "R". Tapping R restarts the loop as the code suggests.

Question 2 is, how can I tell the location on my screen for the Lure version of this code. I see the X,Y curdinates but due to the nature of Rift and the UI being entirely modifyable it is most likley a fact that I have moved my bags and other UI locations. :? As well it seems that when i manually apply a "Rare fishing lure" with 5 charges, on the final cast when the charges are going to be depleted it tends to miss my final fish. My guess is it's caused by the new Yellow message that states "Your Lure has decayed from your pole" and the code gets jumpy and assumes its time to click again too soon. Resulting in a missed fish.

Thanks again! Minor questions I hope. Loads of fun so far still. Saving me lots of stress for raid feasts. Much appreciated.

NotCoder
  • Members
  • 38 posts
  • Last active: Apr 21 2014 01:57 AM
  • Joined: 22 Jun 2012
@Rifter Thank You! :D

@Merge If turning on your noncombat log doesn't fix it let me know.

@Guest Try customizing the script according to you personal needs. (Check code for notes)
If you need help finding your mouse location try using AHK's built in actions recorder and clicking on your pole to get the coordinates.

Also by latency do you mean connection latency or PC lag autolooting?

See below for updated script


GaMbi
  • Members
  • 1 posts
  • Last active: Nov 23 2013 11:09 PM
  • Joined: 01 Jul 2012
Hi! Im new at AHK :)
This is the first script iw tryed and it works "perfectly"!
I had one problem though.. If I get attacked or for some other reason the script gets stopped, it dosnt restart unless I start it manualy.
With the help of gamax92 I got a few lines of code added to fix this "problem".
Basicly it restarts the script if "reel, away, stop fishing, received" dosnt show up within 30 sec of the cast.

IfWinNotActive, RIFT, , WinActivate, RIFT,
WinWaitActive, RIFT,

count :=0

top:
FileDelete, C:\Program Files (x86)\RIFT Game\log.txt
count := (count+1)
fish :=0
line :=0
last_line :=0
sleep, 500
Send, -
sleep, 400
MouseClick, left,  876,  373
Sleep, 200

If count > 10 ;change this number to 5 for rare lure
     goto bait

Go:
[color=#00BF00]Timer := A_TickCount
Go-Loop:[/color]
{
Loop, read, C:\Program Files (x86)\RIFT Game\log.txt
    last_line := A_LoopReadLine
{
sleep, 200
IfInString, last_line, Reel
    Goto, reel
IfInString, last_line, away
    Goto, top
IfInString, last_line, [color=#FF0000]stop fishing[/color]
    Goto, top
IfInString, last_line, received
    Goto, top
[color=#00BF00]If A_TickCount - Timer < 30000
    Goto, Go-Loop[/color]
Goto, top
}
}

reel:
Loop
{
FileDelete, C:\Program Files (x86)\RIFT Game\log.txt
fish :=0
line :=0
last_line :=0
sleep, 200
Send, -
goto go
}

bait:
Loop
{
sleep, 200
Send, 0
sleep, 200
MouseClick, left,  1601,  883 ;change these coordinates to match your needs
sleep, 4000
Reload
}

p::Pause
r::Reload
Escape::ExitApp
It is tested and works perfectly!

Also, "IfInString, last_line, fishing" should be chaged to "IfInString, last_line, stop fishing" (or "you stop fishing") or you will loose a catch when it says "Lure has decayed from your fishing pole"
It says this after the first "reel it in!" of the last charge, wich will caurse the fish to get away.. Thats every 5 fish if you use rare fishing lure.

Enjoy.

NotCoder
  • Members
  • 38 posts
  • Last active: Apr 21 2014 01:57 AM
  • Joined: 22 Jun 2012
Good catch on that "Fishing" thing. The script was originally written to be used without lures so I guess I forgot about that conflict.

AlsoI liked the timed delay in case of miscast so I've implemented it as well.

Lastly since all the new timed lures have been deploye I've rewritten a lot of it to rebait according to the lure decaying as opposed to a count.

Here's the newness 8-)

IfWinNotActive, RIFT, , WinActivate, RIFT, 
WinWaitActive, RIFT, 

fish :=0

top:

FileDelete, C:\Program Files (x86)\RIFT Game\log.txt
last_line :=0
sleep, 500
Send, -
sleep, 400
MouseClick, left,  876,  373
Sleep, 200

If fish = 1
     goto bait

go:
Timer := A_TickCount
Go-Loop:
{
Loop, read, C:\Program Files (x86)\RIFT Game\log.txt
    last_line := A_LoopReadLine
{
sleep, 200
    IfInString, last_line, lure has decayed
	fish :=1
    IfInString, last_line, Reel
	goto reel
    IfInString, last_line, away
	goto top
    IfInString, last_line, stop fishing
	goto top
    IfInString, last_line, received
	goto top
    If A_TickCount - Timer < 30000
                 Goto, Go-Loop
Goto, top
}
}

reel:
Loop
{
FileDelete, C:\Program Files (x86)\RIFT Game\log.txt
last_line :=0
sleep, 200
Send, -
goto go
}

bait:
Loop
{
fish :=0
sleep, 200
Send, 0
sleep, 200
MouseClick, left,  1601,  883
sleep, 4000
Reload
}

p::Pause
r::Reload
Escape::ExitApp

P.S. Sorry for the delay but, as you likely know, 1.9 dropped and I've been grinding my guy up to p50. :wink:

jerbo
  • Members
  • 7 posts
  • Last active: Jul 08 2012 01:04 AM
  • Joined: 08 Jul 2012
Nice script for fishing! I like it in that I don't have to be as bleary-eyed watching for Reel it in!. Also with a 5 yr old running around it is nice to be able to step away while fishing for the quick "kid check" when they are visiting.

However using the 'R' 'P' to restart and pause the script caused problems if I was typing something in chat, And hitting escape to close a map window or other window caused the script to stop, so I made the following adjustments to the script:
1. First I changed to execute the script after it is loaded by using Alt-F (for fishing, so make sure you don't use this key combo)
a. Additionally I changed the other keys to Alt-R, Alt-P, and also Alt-Q (to quit)
b. Make sure you do not have any of these keys mapped in your keymappings.2. Second, Removed the coordinates for the mouseclick (just make sure to first position the mouse over a fisable area prior to starting the script with Alt-F.)
3. Third, Changed the program log location to C:\Program Files (x86)\RIFT\log.txt which is where the log file is on my system.
4. Forth, Put my fishing pole on the 4th action bar (Send, {Shift Down}4{Shift Up}1{Shift Down}1{Shift Up}) and switched to this bar for casting the fishing pole and then switching back to the 1st bar (so I can fight if needed.)[/list]
Here is the code:
!f::
IfWinNotActive, RIFT, , WinActivate, RIFT, 
WinWaitActive, RIFT, 

fish :=0

top:
FileDelete, C:\Program Files (x86)\RIFT\log.txt
last_line :=0
sleep, 500
Send, {Shift Down}4{Shift Up}1{Shift Down}1{Shift Up}
sleep, 100
MouseClick
sleep, 100

If fish = 1
     goto bait

go:
Timer := A_TickCount
Go-Loop:
{
Loop, read, C:\Program Files (x86)\RIFT\log.txt
    last_line := A_LoopReadLine
{
sleep, 100
    IfInString, last_line, lure has decayed
   fish :=1
    IfInString, last_line, Reel
   goto reel
    IfInString, last_line, away
   goto top
    IfInString, last_line, stop fishing
   goto top
    IfInString, last_line, received
   goto top
    If A_TickCount - Timer < 30000
                 Goto, Go-Loop
Goto, top
}
}

reel:
Loop
{
FileDelete, C:\Program Files (x86)\RIFT\log.txt
last_line :=0
sleep, 100
MouseClick
goto go
}

bait:
Loop
{
fish :=0
sleep, 200
Send, 0
sleep, 200
MouseClick
sleep, 4000
Reload
}

!p::Pause
!r::Reload
!q::ExitApp

Please feel free to comment on other improvements that could be made, and again, great job! Not sure about the baiting bit since near as I could tell, it was using the action bar 0 for applying the lure, but since I don't usually use bait right now.

NotCoder
  • Members
  • 38 posts
  • Last active: Apr 21 2014 01:57 AM
  • Joined: 22 Jun 2012
The adjustments are great and I'm glad to see everyone is finding it so easy to customize. It was my goal to make the script as simple and transparent as possible.

I have only one real concern with your mods and it is, as you suggested, the baiting.

Bait has to be applied directly to the pole (in your actual inventory) so when/if you do decide to start using bait it is likely you may need to put in mouse coordinates corresponding to your needs.

jerbo
  • Members
  • 7 posts
  • Last active: Jul 08 2012 01:04 AM
  • Joined: 08 Jul 2012
I agree on the baiting, however for me I bait prior to fishing anyway. I don't really use it as a 'bot' but instead I use it when I have some down time and want to get some fishing in. But I always hate waiting for the 'Reel it in!' and it does get tedious after awhile. Also, having my 5 year granddaughter old over at times takes my attention away from the game for a minute or two, and this way I can keep fishing while I wrangle her up :) I plan on expanding on your scrip as an exercise to myself to vary the cast time and cast locations to a small degree. This way it will not look like a 'bot' if monitoring is involved.

Rifter
  • Guests
  • Last active:
  • Joined: --
Ahhk, I give. I have struggled to trouble shoot the bait version of the loop for several days and end up frustrated and just applying bait manually when needed then letting the standard non-bait loop work its magic. I have adjusted the coordinates to my pole, and set my bait as 0 on the hot-bar with my pole as -. As well I have adjusted my resolution to accommodate the original coordinates for the creators pole location and placed the pole accordingly; with the same result.

The Loop will proceed as intended finishing, then upon using up its charges it will attempt to apply the next lure. The mouse emits a blue aura because it has selected the bait correctly then proceeds to mouse over my pole icon in my bag, but fails to actually apply the lure. It hovers with the lure, runs its intended sleep duration of four seconds, then restarts the fishing process. Meanwhile during this ordeal when my lure should be applying, instead my line is in the water. Until the sleep timer expires because the new lure should be attached, it reels in the line and re-casts it.

I have attempted several troubleshooting options. Both with resolution and pole placement, the mouse is standard Right-hand setup so MouseClick, Left should be the correct selection. I've copied the script exactly and had the same outcome. I attempted all interface options for Ability Que "None, Short, and Full" all with the same results. I just noted one option overlooked and that is "Use ability on Key press" Assume the outcome is similar to the rest, if not I will update my post.

Any ideas? It just seems my script fails to get the left Click off correctly when attempting to apply the bait, all else works seamlessly.

Regards,
Rifter

jerbo
  • Members
  • 7 posts
  • Last active: Jul 08 2012 01:04 AM
  • Joined: 08 Jul 2012
Rifter I understand your anguish, so I have re-written the script and commented it as much as possible. I have also removed all the 'goto' statements and restructured it to use 'gosub' instead. (Call it a quirk left over from my coding days to never use 'goto') I also removed the timer bit because when a timed lure decays you get the same decay message, so no need to keep track of the time.

The first section is where you can modify specific variables to suit your environment. I included a variable to hold the location to my RIFT log.txt file. And, for my situation I use the hot bars (1-6) to place my fishing pole and my bait. For me that is bar #4, with the pole on button 1, and the bait on button 2 (using the default button keymapping for RIFT.)

Next since you can't just press button 2 (while on bar #4,) and then apply the bait to the pole on button 1 (even using the mouse,) we need to open our bags, and apply the bait to the pole there. So we need to know where the pole is when we open our bags. To do this use the 'AutoIt3 Window Spy' program located in the AutoHotKey program folder. First while in RIFT open your bags and take note where your fishing pole is located. Now start 'AutoIt3 Window Spy', and then hover your mouse over your fishing pole in your bags. Write down the values for the Mouse Position (In Active Window). These are the values you will use for barPoleX and barPoleY.

That's it. Save the file and load it up. Next, it's time to start fishing. First apply your bait prior to starting, then while you have your mouse over a fishing area (i.e WATER! :) ) press Alt-F to start fishing. You should cast and then the rest is on autopilot.

And remember Alt-P to pause, Alt-R to reload, and Alt-Q to quit the script.

Please note I take no responsibility for the contents of the code, and I personally use this to help prevent repetitive motion syndrome, and am monitoring my toon at all times.

!f::   ; Start Fishing
IfWinNotActive, RIFT, , WinActivate, RIFT, 
WinWaitActive, RIFT, 

; ****************************************************************************
; ************************ Modifyable variables ******************************
; ****************************************************************************

; Store the location of log.txt in the RIFT program folder
logFileLoc = C:\Program Files (x86)\RIFT\log.txt

; First we need to know where we have placed the fising pole on our buff bars
; In my case I placed my pole and bait on bar #4, 
; with the pole on button #1 and the bait on button #2
startBuffBarNo = 1 ; Which buff bar to rotate back to when done (usually 1)
poleBuffBarNo = 4  ; Which buff bar the fising pole is on
poleBuffKey = 1  ; Which button is used for the pole
baitBuffKey = 2  ; Which button is used for the bait

; Next since we can't press the button to apply the bait
; we need to know the coordinates for the pole in our bags.
; To do this I opened 'AutoIt3 Window Spy' (included with AHK
; and recorded the Mouse Position (In Active Window) coordinates
; while hovering over the fishing pole button when my bags are opened.
; NOTE - DO NOT MOVE YOUR BAG WITH THE FISHING POLE ONCE
;        YOU HAVE RECORDED THE POSITION.
; 
barPoleX = 860  ; Buff Bar X position for the fishing pole
barPoleY =  70  ; Buff Bar Y position for the fishing pole

; ****************************************************************************
; ********************  END OF MODIFYABLE VARIABLES **************************
; ****************************************************************************


; ****************************************************************************
; ******************** Actual Start of the script  ***************************
; ****************************************************************************
; First, I want to store the current position for the fishing location.
; In other words I need to save where to recast the pole after aplying any bait.
MouseGetPos, xFish, yFish  ; Get the initial mouse position for fishing

fishbait :=1			; Indicate that we may have bait
Gosub, cast				; Make our first cast						
Loop
	{
		Gosub, checkresults	; Check and see if we got anything
		If fishbait = 0			; Our bait has decayed
			Gosub, bait		; Rebait the hook
		Gosub, cast			; Cast a new line
	}

			
checkresults:
	Loop
		{		
			Loop, read, %logFileLoc%     				; Open and read our log file
				last_line := A_LoopReadLine				; Read the last line of the file

			IfInString, last_line, lure has decayed
				{
					fishbait :=0						; No more bait, so rebait hook 
					Continue							; before recasting
				}
			IfInString, last_line, Reel					; Something on the line
				{
					Gosub, reel							; Attempt to reel it in!
					Continue
				}
			IfInString, last_line, away					; Fish got away (recast)
				Return
			IfInString, last_line, stop fishing			; We stopped Fishing (recast)
				Return
			IfInString, last_line, received				; Caught something (recast)
				Return

		}

cast:
{
		FileDelete, %logFileLoc%					  ; Clear out the log file
		last_line :=0
		sleep, 500
		Send, {Shift Down}%poleBuffBarNo%{Shift Up}   ; Switch to bar with fishing pole
		Send, %poleBuffKey%                           ; Select the fising pole button
		Send, {Shift Down}%startBuffBarNo%{Shift Up}  ; Return to original Buff Bar
		sleep, 100
		MouseClick, Left , %xFish%, %yFish%           ; Cast our line to original position
		sleep, 100
		Return
}	
	
	
reel:
	{
		FileDelete, %logFileLoc%
		last_line :=0
		sleep, 100  		; Wait a fraction of a second
		MouseClick			; Real it in click (does not matter if the mouse moved)
		Return				; Return and recast the line
	}

bait:
	{
		; Since you can't just press the bait button and then the pole button 
		; to rebait you will need to open your bags to apply the bait.
		; Naturally your bags should be closed at this time.
		fishbait :=1									; Reset bait flag
		sleep, 100
		Send, b  										; Open our bags
		Sleep 1000										; Wait for the bags to open
		Send, {Shift Down}%poleBuffBarNo%{Shift Up}  	; Switch to fishing pole buff bar
		Send, %baitBuffKey%                          	; Press our bait key
		sleep, 500										; Wait half a sec
		MouseClick, Left , %barPoleX%, %barPoleY%    	; Click on the pole (in our bag)
		sleep, 3500   									; Wait 3.5 seconds to allow buff to apply
		Send, b      									; Close our bags
		sleep, 500
		Send, {Shift Down}%startBuffBarNo%{Shift Up}  	; Return to original Buff Bar

		Return      									; Recast 
	}

!p::Pause    ; Pause the script
!r::Reload   ; Reload the script
!q::ExitApp  ; Exit the script


NotCoder
  • Members
  • 38 posts
  • Last active: Apr 21 2014 01:57 AM
  • Joined: 22 Jun 2012
@Rifter please try the newest version of the script, and if that doesn't work pm me and I'll get with you via ventrilo to help you troubleshoot.

@Jerbo I appreciate what you've done however the timer was actually not there for anything to do with baiting it was to restart the script if for some reason you have stopped fishing for a certain amount of time i.e. your attacked or for some reason the script gets stuck in a loop.