I need get the message: You Can not throw there.
And I'm not getting by proxy, after some research find that this error comes from the client, but is to capture that error by xenobot?
Printable View
I need get the message: You Can not throw there.
And I'm not getting by proxy, after some research find that this error comes from the client, but is to capture that error by xenobot?
Can you make more detailed post?
What script were you using, is it OX scripts? Is it public scripts? Scripts fault? Post script here then...
lua code:
ErrorMessageProxy.OnReceive("My Proxys Name", function(proxy, message)
if message == "You cannot throw there." then
-- Do something
end
end)
I tried this earlier, but as I said this response is given by the client and not by the server package. This topic (
http://forums.xenobot.net/showthread...orMessageProxy) they talk about it, but I did not find any other alternative to correct this problem :/.
http://forums.xenobot.net/showthread...orMessageProxy
I tried this earlier, but as I said this response is given by the client and not by the server package. This topic they talk about it, but I did not find any other alternative to correct this problem: x.
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.
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)
Line:Quote:
20:24 XenoScript Error:
Script: Config Advance Runes - Kazz.lua
Line #: 225
Chunk: ...Users?DanielB?DOCUME?1?XenoBot?Scripts??CONFIG? 3.LUA
Error: bad argument #1 to 'unpack' (table expected, got nil)
This is an error with user-input and should not be reported as a bug with XenoBot.
lua code:if Self.UseItemWithGround(rod, unpack(pos)) then
The first time went well, but is now giving this problem.
Ah, there's no fishable water on the screen, I edited it to handle that situation.