Vent
Terrarian
So, fishing is tedious and hateful. I have a script for that. This uses Autohotkey.
First, some important notes:
- This script is a development of a script written by the glow. His original can be found in a thread here. Many parts of the code below are taken directly from his. He should receive the lion's share of credit for the final product here.
- This script is designed for 1080p resolution. If you play on a different resolution, you'll have to tweak some of the X, Y coordinates in the code.
- Because of (I believe) some wonkiness with DirectX, Windows Aero doesn't play well with this script when the game is fullscreened. In order for the script to work, Windows has to be in "Windows Classic" mode. Right click your desktop and hit Personalize to bring this up. This is on Windows 7. I'm not sure how the script interacts with Windows 8 or 10.
- The script doesn't like blocks or other items (golden chests, demon torches, etc.) that change the color of surrounding pixels. Avoid them in your fishing build.
Second, some instructions on usage:
- Find a fishing area where the water is directly below you (use platforms or UFO or whatever).
- Place your cursor anywhere near the water line, though slightly over the waterline works best. Horizontal position of the cursor doesn't matter.
- This script will automatically rebuff, so don't have any potions in your inventory except for fishing and crate potions.
- Have lots of bait (thousands is good), load up +fishing gear, pull up your fishing rod the inventory, and then hit F2.
- Turn off your monitor, go to sleep, and wake up to thousands of fish, crates, and accessories.
Using this script I had about 2500 crates ready for hardmode without any manual fishing to speak of.
Some unhelpful pics. Credit to Papabear for his fishing arena. The original design can be found here.
Line up the cursor and press F2:
Win! Now go to sleep:
Let me know if you find any bugs!
Edit: Added the compare function, which I had forgotten about.
Later edits: Bugs and tweaks.
First, some important notes:
- This script is a development of a script written by the glow. His original can be found in a thread here. Many parts of the code below are taken directly from his. He should receive the lion's share of credit for the final product here.
- This script is designed for 1080p resolution. If you play on a different resolution, you'll have to tweak some of the X, Y coordinates in the code.
- Because of (I believe) some wonkiness with DirectX, Windows Aero doesn't play well with this script when the game is fullscreened. In order for the script to work, Windows has to be in "Windows Classic" mode. Right click your desktop and hit Personalize to bring this up. This is on Windows 7. I'm not sure how the script interacts with Windows 8 or 10.
- The script doesn't like blocks or other items (golden chests, demon torches, etc.) that change the color of surrounding pixels. Avoid them in your fishing build.
Second, some instructions on usage:
- Find a fishing area where the water is directly below you (use platforms or UFO or whatever).
- Place your cursor anywhere near the water line, though slightly over the waterline works best. Horizontal position of the cursor doesn't matter.
- This script will automatically rebuff, so don't have any potions in your inventory except for fishing and crate potions.
- Have lots of bait (thousands is good), load up +fishing gear, pull up your fishing rod the inventory, and then hit F2.
- Turn off your monitor, go to sleep, and wake up to thousands of fish, crates, and accessories.
Using this script I had about 2500 crates ready for hardmode without any manual fishing to speak of.
Code:
#NoEnv
#MaxHotkeysPerInterval 9999
#MaxThreadsPerHotkey 2
SetTitleMatchMode 2
; Terraria initialize
global c_delay := 30
global breakLoop := 0
*~Esc::breakLoop = 1
#IfWinActive ahk_exe Terraria.exe
;*** SUSPEND HOTKEY
;*
*Pause::
Suspend
Pause
return
;*** CHAT SUSPENDS ALL HOTKEYS
;*
;* This will occasionally glitch, fix by using the general Suspend key above.
*~Enter::
Suspend
Pause
return
;*** FUNCTION: mClick
;*
mClick(f_delay:=0, x:="", y:="") {
Send {Click down %x%, %y%}
Sleep %c_delay%
Send {Click up}
Sleep %c_delay%
Sleep %f_delay%
}
;*** FUNCTION: keyClick
;*
keyClick(f_delay, key) {
Send {%key% down}
Sleep %c_delay%
Send {%key% up}
Sleep %c_delay%
Sleep %f_delay%
}
;*** AUTOMATIC FISHING
;*
;* Windows desktop settings must be at "Windows Classic"
F2::
MouseGetPos, WaterX, WaterY ; Get vertical position of cursor (should point just above water line)
Loop {
if (breakLoop = 1)
break
mClick(2200, 970, 900) ; Cast the line & wait for bob to settle
if (breakLoop = 1)
break
PixelGetColor, colorA, 969, %WaterY% ; Get the color of the bob
colorB1 := colorA ; Set the variables which will monitor for changed color of the bob
colorB2 := colorA
colorB3 := colorA
Loop, 100 { ; Wait for the bob to move
if (breakLoop = 1)
break
PixelGetColor, colorB1, 969, %WaterY%
Sleep 10
PixelGetColor, colorB2, 969, %WaterY%
Sleep 10
PixelGetColor, colorB3, 969, %WaterY%
Sleep 10
if (compare(colorA, colorB1) > 5) {
if (compare(colorA, colorB2) > 5) {
if (compare(colorA, colorB3) > 5) {
Sleep 100
mClick(0, 970, 900)
break
}
}
}
}
keyClick(0, "b") ; Renew buffs
}
breakLoop = 0
return
compare(c1, c2) {
rdiff := Abs((c1 >> 16) & 0xFF - (c2 >> 16) & 0xFF)
gdiff := Abs((c1 >> 8) & 0xFF - (c2 >> 8) & 0xFF)
bdiff := Abs(c1 & 0xFF - c2 & 0xFF)
return rdiff + gdiff + bdiff
}
#IfWinActive
Some unhelpful pics. Credit to Papabear for his fishing arena. The original design can be found here.
Line up the cursor and press F2:
Win! Now go to sleep:
Let me know if you find any bugs!
Edit: Added the compare function, which I had forgotten about.
Later edits: Bugs and tweaks.
Last edited: