View Full Version : Get message error
brindeds
12-28-2015, 12:46 AM
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?
krille09
12-28-2015, 12:53 AM
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...
brindeds
12-28-2015, 12:59 AM
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...
My script. What I want is when the message can not fish more in this place, it deletes the location of the table. That is, so give the error message returned by the customer, he makes this callback. The problem is that I know nothing find this message.
shadowart
12-28-2015, 09:38 AM
ErrorMessageProxy.OnReceive("My Proxys Name", function(proxy, message)
if message == "You cannot throw there." then
-- Do something
end
end)
brindeds
12-28-2015, 12:14 PM
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.php?17358-errormessage-proxy-thing!&highlight=ErrorMessageProxy) they talk about it, but I did not find any other alternative to correct this problem :/.
brindeds
12-28-2015, 12:20 PM
ErrorMessageProxy.OnReceive("My Proxys Name", function(proxy, message)
if message == "You cannot throw there." then
-- Do something
end
end)
http://forums.xenobot.net/showthread.php?17358-errormessage-proxy-thing!&highlight=ErrorMessageProxy
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.
shadowart
12-28-2015, 12:57 PM
http://forums.xenobot.net/showthread.php?17358-errormessage-proxy-thing!&highlight=ErrorMessageProxy
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.
"You cannot throw there." messages can be caught by an ErrorMessageProxy. That's what you get from fishing in a bad spot. If you tried it earlier you did it wrong, and/or is playing an OT with different behaviour. I've got it working on real Tibia.
brindeds
12-28-2015, 06:38 PM
"You cannot throw there." messages can be caught by an ErrorMessageProxy. That's what you get from fishing in a bad spot. If you tried it earlier you did it wrong, and/or is playing an OT with different behaviour. I've got it working on real Tibia.
I tested here and realized the callback only occurs when I manually. The problem that the fishing of module is active when this error happens, and when the module is active it does not activate the callback at all. It would be a bug or something I unaware?
shadowart
12-28-2015, 06:53 PM
I tested here and realized the callback only occurs when I manually. The problem that the fishing of module is active when this error happens, and when the module is active it does not activate the callback at all. It would be a bug or something I unaware?
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:
-- 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.
brindeds
12-28-2015, 09:11 PM
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:
-- 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.
-----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.
shadowart
12-28-2015, 10:04 PM
This works if you stand still. But if you move around you'll want to use different blacklists for each position.
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)
brindeds
12-28-2015, 10:27 PM
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.
Line:
if Self.UseItemWithGround(rod, unpack(pos)) then
The first time went well, but is now giving this problem.
shadowart
12-28-2015, 10:28 PM
Ah, there's no fishable water on the screen, I edited it to handle that situation.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.