Page 1 of 1

Pumpkin Festival Error

Posted: Mon Nov 26, 2012 11:58 am
by kx3killza
When i am running this script,
every few hours or so the bot stops and this message comes up on the micromacro window

User\Desktop\bot\micromacro\scripts\rom/bot.lua:505: onLoad error: [string "..."]:105: attempt to index local 'SmallStack' <a nil value>

I have not changed anything in the folders after the initial setup of SVN checkout on the rom folder in the micromacro folder,

Here is the waypoint im currently using,


-- wplata surek, zielone i opisane
GuildDonate()
GuildDonateItems({"Guild Rune", "xx", "oo"})
keptitems = {203163, 203086, 203087, 203085, 203291, 203292, 203293, 203294, 203295, 240743}

keptitems = {203163, 203086, 203087, 203085, 203291, 203292, 203293, 203294, 203295, 240743}

for k,v in pairs(keptitems) do
if inventory:itemTotalCount(v) > 0 then
local SmallStack = inventory:findItem(v);
SmallStack:delete();
end;
end;


</onLoad>
</waypoints>

If anyone can help me it would be very appreciated!

Thanks

Re: Pumpkin Festival Error

Posted: Mon Nov 26, 2012 12:07 pm
by rock5

Code: Select all

 inventory:findItem(v)
will return nil if it doesn't find an item. Therefore

Code: Select all

SmallStack:delete()
will cause and error. Try

Code: Select all

if SmallStack then
    SmallStack:delete()
end

Re: Pumpkin Festival Error

Posted: Mon Nov 26, 2012 1:14 pm
by kx3killza
sorry but im pretty stupid when it comes to lua codes

but where do i put

if SmallStack then
SmallStack:delete()
end

and do i need to replacing something with that?

Re: Pumpkin Festival Error

Posted: Mon Nov 26, 2012 1:17 pm
by rock5
Search through the file and find

Code: Select all

SmallStack:delete();
and change it to

Code: Select all

if SmallStack then
    SmallStack:delete();
end

Re: Pumpkin Festival Error

Posted: Mon Nov 26, 2012 1:26 pm
by kx3killza
thanks :)

Re: Pumpkin Festival Error

Posted: Fri Dec 07, 2012 3:09 am
by SpringSun
can i just remove the line SmallStack:delete(); ?
i let lootomatic do the rest,because my bot keep stop working with that smallstack issue