This works if you stand still. But if you move around you'll want to use different blacklists for each position.
lua code:
local function posToNum(x, y)
return 1000000*x + y
end
local theBlacklist = {}
local function blacklist(pos)
theBlacklist[posToNum(unpack(pos))] = true
end
local function isBlacklisted(pos)
return theBlacklist[posToNum(unpack(pos))]
end
local isFishable = {
[4597] = true,
[4598] = true,
[4599] = true,
[4600] = true,
[4601] = true,
[4602] = true,
}
local function getFishableSquare()
local pos = Self.Position()
for x = -7, 7 do
for y = -5 ,5 do
local p = {pos.x+x, pos.y+y, pos.z}
if isFishable[Map.GetTopUseItem(unpack(p)).id] and not isBlacklisted(p) then
return p
end
end
end
end
local pos
local rod = Item.GetID("Fishing Rod")
Module("Fisher", function(self)
pos = getFishableSquare()
if pos and Self.UseItemWithGround(rod, unpack(pos)) then
self:Delay(1000)
end
end)
ErrorMessageProxy.OnReceive("My Proxys Name", function(proxy, message)
if message == "You cannot throw there." then
blacklist(pos)
end
end)