Page 1 of 1

local variable error

Posted: Wed Nov 06, 2013 1:59 pm
by wilifox
my waypoint is this:

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<!-- #  1 --><waypoint x="-4149" z="5716" y="36">

                player:target_NPC("Calabaza bromista");
		local x = inventory:findItem("Piruleta de arco iris")
                x:moveTo("bank") 
		sendMacro("ChoiceOption(1);");
		sendMacro("DrawBankItem(1);");

	</waypoint>
</waypoints>
Script Error: Why?? Thxx ;)

Image

Re: local variable error

Posted: Wed Nov 06, 2013 4:51 pm
by lisa
If it can't find the item named then x will be nil.

If you are sure you have the item in your inventory then you may need to change the name or use the item ID instead.

If there are times when you may not have the item then you should do a check if x exists.

Code: Select all

      local x = inventory:findItem("Piruleta de arco iris")
if x then
                x:moveTo("bank") 
      sendMacro("ChoiceOption(1);");
      sendMacro("DrawBankItem(1);");
end