
Originally Posted by
shadowart
Sounds like you might have to redesign your fishing module to get it to work. I'd have the fishing module only attempt to fish one square each try, and also store that square in a variable. Then if the proxy detects the error message it blacklists the last attempted square. In pseudo-code:
lua code:
-- The implementations for getFishableSquare, isBlacklisted and blacklist are missing.
-- You'll have to implement them yourself.
local pos
Module("Fisher", function(self)
pos = getFishableSquare()
if not isBlacklisted(pos) then
Self.UseItemWithGround("Fishing Rod", pos.x, pos.y, pos.z)
self:Delay(1000)
end
end)
ErrorMessageProxy.OnReceive("My Proxys Name", function(proxy, message)
if message == "You cannot throw there." then
blacklist(pos)
end
end)
The module and the proxy cannot execute at the exact same time, but the proxy can execute during the way between module calls.
getFishableSquare() it is a function that returns a table? Why not have several places where you can fish? :x. From what I realized is no loop to cross it.
lua code:
-----Initial Function getFishableSquare
function getFishableSquare()
local waterFish = {4597, 4598, 4599, 4600, 4601, 4602}
local pos = Self.Position()
local fishTiles = {}
for x = -7, 7, 1 do
for y = -5, 5, 1 do
local tileId = Map.GetTopUseItem(pos.x + x, pos.y + y, pos.z).id
if (table.contains(waterFish, tileId)) then
tilePos = {x = pos.x + x, y = pos.y + y, z = pos.z, error = false}
table.insert(fishTiles, tilePos)
end
end
end
return fishTiles
end
-----End Function getFishableSquare
-- The implementations for getFishableSquare, isBlacklisted and blacklist are missing.
-- You'll have to implement them yourself.
local pos
Module("Fisher", function(self)
pos = getFishableSquare()
if not isBlacklisted(pos) then
-- Self.UseItemWithGround("Fishing Rod", pos.x, pos.y, pos.z)
-- self:Delay(1000)
print("teste")
end
end)
-----Initial Function blackList
local blackList = {}
function blackList(pos)
table.insert(blackList, pos)
end
-----End Function blackList
-----Initial Function isBlacklisted
function isBlacklisted(pos)
for key,value in blackList do
if(table.contains(pos, blackList[key])) then
return true
else
return false
end
end
end
-----End Function isBlacklisted
ErrorMessageProxy.OnReceive("My Proxys Name", function(proxy, message)
if message == "You cannot throw there." then
blackList(pos)
end
end)
I do not know what else to try. I am completely exhausted kk.