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
jerbo
  • Members
  • 8 posts
  • Last active: Sep 27 2015 01:37 AM
  • Joined: 08 Jul 2012
@NotCoder - Your absolutely right, and sorry I spaced it when reading back on the post.

So here is the update to add the timer back into the script. It is extensively commented too. I also added some random ability to vary the time between casts, and button presses. (To simulate more inline with human pressing the buttons.) Also, I have it cast around in the general area of where you have the mouse pointed to. Again to add some randomness. Enjoy!

!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
poleKey = 1  ; Which button is used for the pole
baitKey = 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.
; 
bagPoleX = 860  ; Bag X position for the fishing pole
bagPoleY =  70  ; Bag 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
			If A_TickCount - Timer < 30000				; Lot of time past (maybe attacked?)
				Gosub, cast								; Try recasting the line
				Return
				
		}

cast:
{
		Timer := A_TickCount
		FileDelete, %logFileLoc%					  ; Clear out the log file
		last_line :=0
		sleep, % NormalRand(400, 600)
		Send, {Shift Down}%poleBuffBarNo%{Shift Up}   ; Switch to bar with fishing pole
		sleep, % NormalRand(500, 2300)
		Send, %poleKey%                           ; Select the fising pole button
		sleep, % NormalRand(800, 3000)
		randX := NormalRand(xFish - 10, xFish + 30)
		randY := NormalRand(yFish - 10, yFish + 30)
		MouseClick, Left , %randX%, %randY%           ; Cast our line close to original position
		Send, {Shift Down}%startBuffBarNo%{Shift Up}  ; Return to original Buff Bar
		sleep, % NormalRand(80, 300)

		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, % NormalRand(50, 300)
		Send, b  										; Open our bags
		Sleep % NormalRand(800, 1500)					; Wait for the bags to open
		Send, {Shift Down}%poleBuffBarNo%{Shift Up}  	; Switch to fishing pole buff bar
		Send, %baitKey%                          	; Press our bait key
		sleep, % NormalRand(400, 800)					; Wait half a sec
		MouseClick, Left , %bagPoleX%, %bagPoleY%    	; Click on the pole (in our bag)
		sleep, % NormalRand(3200, 4500)   				; Wait 3.5 seconds to allow buff to apply
		Send, b      									; Close our bags
		sleep, % NormalRand(400, 800)
		Send, {Shift Down}%startBuffBarNo%{Shift Up}  	; Return to original Buff Bar

		Return      									; Recast 
	}

NormalRand(x,y,int=1) { ;x lower y upper int for integer return
Loop 12
 {
 Random, var,0.0,1
 Num+=var
 }
norm := (int) ? Round((y+x)/2+((Num-6)*(y-x))/6) : (y+x)/2+((Num-6)*(y-x))/6
Return norm < x ? x : norm > y ? y : norm
}	
!p::Pause    ; Pause the script
!r::Reload   ; Reload the script
!q::ExitApp  ; Exit the script


Nihilum
  • Guests
  • Last active:
  • Joined: --
I have absolutely no experience with coding. I was wondering how you actually use the script for fishing. Is it a script entered in game or is it used like an addon?

jerbo
  • Members
  • 8 posts
  • Last active: Sep 27 2015 01:37 AM
  • Joined: 08 Jul 2012
READ ALL OF THIS BEFORE STARTING. :)

Think of AutoHotKey as a glorified macro application that sends key-presses and mouse-clicks to your programs.

So, to use this script in conjunction with AutoHotKey, you first need to install it from http://www.AutoHotKey.com.

After this you would save the above script to a file that you create by saving to a text file and call it something like Fishing.ahk. Then you can double click the file to start the script (you should see a green "H" in your system tray.)

Then, Start RIFT. Next start logging by typing /log in your chat window. While still in Rift (preferably in Full screen windowed mode,) you just go to an area that you would like to fish from. Point your mouse to rest over the water (that you would normally cast your fishing pole to,) and then press Alt-F to start fishing. Your toon should then start fishing and after "reel it in!" is displayed your toon should automatically attempt to reel it in. Then recast again to the same area you pointed to.

Always remember when you first start RIFT you need to enter /log to start logging.

NOTE- As MY script is written you will need to set your pole to use the 4th bar on your action bars (Press Shift-4 to see this bar,) then place your fishing pole on the button 1 location (far left usually). If you want to use bait and need to re bait the line with new bait, place your bait on slot 2 (or button 2). The only other thing you will then need to do (to re bait your pole,) is to modify the script to show the location where your pole is in your bags. The instructions for doing that is in the comments of the script.

One last note, the location of your RIFT log file may differ depending on when you have installed RIFT. In my case RIFT is located in either C:\Program Files (x86)\RIFT\log.txt for my Desktop and in C:\Program Files (x86)\RIFT Game\log.txt on my Laptop. Just check your system and modify the Fishing.ahk file with notepad to reflect the location of the file.

Anyway with this info and the comments in the file (Fishing.ahk,) you should be fishing in no time.

Nihilum
  • Guests
  • Last active:
  • Joined: --
I've followed your directions completely, but when I double click the .ahk file. I get this error:

Error at Line 1.

Line Text: \rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{f0\fswiss\fcharset0
Arial;}}
Error: This line does not contain an recognized action.

The program will exit.


Not sure what it means, is this something that is easily fixed by modifying the script?

NotCoder
  • Members
  • 38 posts
  • Last active: Mar 30 2016 08:07 PM
  • Joined: 22 Jun 2012
@Nihilum Please try the most recent version of the original script and if you're problem persists PM me and I will arrange to help you troubleshoot via my ventrilo server.

Setup Required:

Attach pole to hotkey "-" in your in-game Hotbar
Set mouse coordinates for fishing location (change may not be necessary)
Enable noncombat logging (type "/log" in in-game chat window)
Set noncombat log file location (change may not be necessary)

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, 

fish :=0

top:

FileDelete, C:\Program Files (x86)\RIFT Game\log.txt [color=#FF0000];Default game log file location.[/color]
last_line :=0
sleep, 500
Send, -
sleep, 400
MouseClick, left,  876,  373 [color=#FF0000];Customize coordinates according to need.[/color]
Sleep, 200

If fish = 1
     goto bait

go:
Timer := A_TickCount
Go-Loop:
{
Loop, read, C:\Program Files (x86)\RIFT Game\log.txt [color=#FF0000];Default game log file location.[/color]
    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 [color=#FF0000];Default game log file location.[/color]
last_line :=0
sleep, 200
Send, -
goto go
}

bait:
Loop
{
fish :=0
sleep, 200
Send, 0
sleep, 200
MouseClick, left,  1601,  883 [color=#FF0000];Customize coordinates according to need.[/color]
sleep, 4000
Reload
}

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


Ilene
  • Guests
  • Last active:
  • Joined: --

I've followed your directions completely, but when I double click the .ahk file. I get this error:

Error at Line 1.

Line Text: \rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{f0\fswiss\fcharset0
Arial;}}
Error: This line does not contain an recognized action.

The program will exit.


Not sure what it means, is this something that is easily fixed by modifying the script?


It means you used an RTF writer to modify save the file. It added formatting info to your text file.
Don't.
Use Notepad, NOT MS Word, Office, Writer or any other windows prog with font formatting options.

Ilene
  • Guests
  • Last active:
  • Joined: --
Thanks a lot for the script, both of you. :)

It works great except for reaplying the bait. The pole click was too fast, my game had no time to notice the item usage (and to turn the cursor blue). I had to modify the code to first move the mouse pointer to the pole in a bag, wait for game to notice that and than clicking to apply the lure.

replaced this:
      MouseClick, %X%, %Y%      ; Click on the pole (in our bag)
with that:
      MouseMove, %X%, %Y%       ; Move cursor to pole in our bag
      Sleep, 500                ; Wait for game to notice item usage
      MouseClick                ; Click on the pole (in our bag)
And don't forget to monitor the toon, while using baits. If there is no more of it to use the script will click your pole, picking it up and trying to delete it. As there is no error message I see no way to catching this.

Guest
  • Guests
  • Last active:
  • Joined: --
Im having same problem as emerge. My noncombat logging is enabled. it cast and recast perfect but i can not get it to bring the fish in. Just keeps saying the fish got away. Am i missing something in the set up?

  • Guests
  • Last active:
  • Joined: --

Im having same problem as emerge. My noncombat logging is enabled. it cast and recast perfect but i can not get it to bring the fish in. Just keeps saying the fish got away. Am i missing something in the set up?



I have same exact problem. I'm not even trying to put bait on just get basic fishing to work. It will cast and recast and will do the first reel it in but after that it just says fish got away.

NotCoder
  • Members
  • 38 posts
  • Last active: Mar 30 2016 08:07 PM
  • Joined: 22 Jun 2012
Which version of the script are you guys running?

Mine or jerbo's

NotCoder
  • Members
  • 38 posts
  • Last active: Mar 30 2016 08:07 PM
  • Joined: 22 Jun 2012
Try going back to the OP and following the instrucitions and using the script as it is written there.

If you continue to have issues please pm me with any pertinent information and I will do my best to help you.

quick note - but one even I often overlook verify that noncombat logging is enabled, when you type"/log" in the game chat window you should see a message that read "noncombat logging enabled"

  • Guests
  • Last active:
  • Joined: --

Im having same problem as emerge. My noncombat logging is enabled. it cast and recast perfect but i can not get it to bring the fish in. Just keeps saying the fish got away. Am i missing something in the set up?



I have same exact problem. I'm not even trying to put bait on just get basic fishing to work. It will cast and recast and will do the first reel it in but after that it just says fish got away.



I got the script working now. It was my own fault haha. I found out this line C:\Program Files (x86)\RIFT Game\log.txt is not right for my game. It should read C:\Program Files (x86)\RIFT\log.txt. They must have changed the name of the game folder at some point in time. Anyways, now it works fine, good job on the script its awesome.

NotCoder
  • Members
  • 38 posts
  • Last active: Mar 30 2016 08:07 PM
  • Joined: 22 Jun 2012
Good to hear you got it going I may need to make a note of it (I think it may have to do with still having Beta installed when the game released.)

Guest2
  • Guests
  • Last active:
  • Joined: --
I have noticed that the script will hang until the next go around with the loot bag open. is there a way to have it send a mouse click to loot the bag so that it doesn't wait an entire time limit before recycling naturally. IE I start script, it goes through the motions, gets a loot window, sits there.

I'm monitoring it, I see the loot window pop open, I carefully L mouse click to loot, and it immediately restarts rather than waiting another 30 seconds

ps, this is for the first script here. The other, more involved one, while I would love that one for the randomness, I flat out could not get to work

NotCoder
  • Members
  • 38 posts
  • Last active: Mar 30 2016 08:07 PM
  • Joined: 22 Jun 2012
Easy fix is to set your game to autoloot.

If you'd rather not use that let me know and I'll post a customized version of the script for you

(I'm at work at the moment and unable to do too much)