-
giantenigma
- Posts: 1
- Joined: Sat Jan 23, 2010 7:57 am
#1
Post
by giantenigma » Tue Jan 26, 2010 6:04 pm
Whenever the bot tries to run this code, it generates an error (see below). Basically, with this code, I am checking my inventory every time I kill an enemy to check to see if it is full. I don't entirely know why the error is ocurring. Should I change "50" to 50, or is there anything else I need to change?
Code: Select all
<onLeaveCombat><![CDATA[
-- Additional Lua code to execute after killing an enemy
if(sendMacro("GetBagCount();") > "50") then
inventory:update();
end
if(sendMacro("GetBagCount();") == "60") then
loadPaths("boarstomerch.xml");
end
]]>
</onLeaveCombat>
Code: Select all
Tue Jan 26 17:37:55 2010 : ...micromacro/scripts/rom/classes/player.lua:804: Error in your profile: onLeaveCombat error: [string "..."]:3: attempt to compare string with number
Tue Jan 26 17:37:55 2010 : Execution error: Runtime error
Thanks in advance!
-
TopaZ
- Posts: 17
- Joined: Mon Jan 25, 2010 5:29 pm
#2
Post
by TopaZ » Tue Jan 26, 2010 6:25 pm
giantenigma wrote:Whenever the bot tries to run this code, it generates an error (see below). Basically, with this code, I am checking my inventory every time I kill an enemy to check to see if it is full. I don't entirely know why the error is ocurring. Should I change "50" to 50, or is there anything else I need to change?
Code: Select all
<onLeaveCombat><![CDATA[
-- Additional Lua code to execute after killing an enemy
if(sendMacro("GetBagCount();") > "50") then
inventory:update();
end
if(sendMacro("GetBagCount();") == "60") then
loadPaths("boarstomerch.xml");
end
]]>
</onLeaveCombat>
Code: Select all
Tue Jan 26 17:37:55 2010 : ...micromacro/scripts/rom/classes/player.lua:804: Error in your profile: onLeaveCombat error: [string "..."]:3: attempt to compare string with number
Tue Jan 26 17:37:55 2010 : Execution error: Runtime error
Thanks in advance!
I am not good at programming but this code will must work.
Code: Select all
<onLeaveCombat>
-- Additional Lua code to execute after killing an enemy
if(sendMacro("GetBagCount();") > 50) then
inventory:update();
end
if(sendMacro("GetBagCount();") == 60) then
loadPaths("boarstomerch.xml");
end
</onLeaveCombat>
-
d003232
- Posts: 1252
- Joined: Wed Jun 03, 2009 4:27 pm
#3
Post
by d003232 » Sat Jan 30, 2010 9:11 am
There could always be, that you get a wrong value back from the "sendMacro" function. e.g. if you press/hold a key while the bot try to press the macro key. So you should be prepared for getting back all kind of values string/nil/numbers and check internaly if it's a valid value.
Who is online
Users browsing this forum: No registered users and 2 guests