Page 1 of 1

I keep getting this error

Posted: Sun Jun 05, 2011 10:42 am
by adonisz
When running my bot, I keep getting this error: Error in your profile: onleavecombat error: ....pawn.lua:537:bad argument #1 to 'gmatch' <string expected, got nil>

my profile looks like this

Code: Select all

	<onLeaveCombat><![CDATA[
		-- Additional Lua code to execute after killing an enemy
                 useGoodie("mdmg2");
     if (not player:hasBuff("506687")) then
    inventory:useItem(207203);
    end 

     if (not player:hasBuff("506686")) then
    inventory:useItem(207202);
    end

     if (not player:hasBuff("506684")) then
    inventory:useItem(207200);
    end 
                catchCavy();
        ]]></onLeaveCombat>
Any idea on how to fix it?
Thanks in advance

Re: I keep getting this error

Posted: Sun Jun 05, 2011 10:49 am
by lisa
you can try to narrow down the cause by making some code not used by adding -- at the front

Code: Select all

-- useGoodie("mdmg2");
I am guessing it is something to do with the useGoodie as the rest of the code that deals with buffs seems ok.
The error is to do with buffs.

Re: I keep getting this error

Posted: Sun Jun 05, 2011 11:09 am
by rock5
Try not surrounding the id numbers with quotes. They are numbers, not strings. :)

Edit: Scratch that. Looks like the buff functions convert the string to a number anyway. Lisa is probably right. It's probably your useGoodie function.

Re: I keep getting this error

Posted: Sun Jun 05, 2011 7:57 pm
by kanta
This works for me:

Code: Select all

	<onLeaveCombat><![CDATA[
		-- Additional Lua code to execute after killing an enemy
		if( not player:hasBuff("Unimaginable Salad") and inventory:itemTotalCount(207215) > 0 ) then
			inventory:useItem(207215)
			inventory:update()
			yrest(750)
		end
		if not player:hasBuff(501823) then
         player:cast("KNIGHT_ENHANCED_ARMOR");
               yrest(300);
		end
	]]></onLeaveCombat>
Maybe without the item check it's getting an error if the item doesn't exist?

Re: I keep getting this error

Posted: Tue Jun 07, 2011 9:44 pm
by adonisz
so i put

Code: Select all

     if (not player:hasBuff("495632")) then
    inventory:useItem(207214);
    end
for my delicious swamp mix and the problem is i eat the swamp mix after each combat, so if I kill one monster, I eat one swamp mix, another monster another swamp mix..... is there something wrong with my code?

Re: I keep getting this error

Posted: Tue Jun 07, 2011 9:47 pm
by lisa
if it is eating the swamp mix then the useitem must be right, so I'd say double check the buff number id.

Re: I keep getting this error

Posted: Tue Jun 07, 2011 10:10 pm
by adonisz
i double checked the buff name id and it is right.
hmm its really weird that my character would just keep eating the swamp mix when the buff is already there...

Re: I keep getting this error

Posted: Tue Jun 07, 2011 11:03 pm
by rock5
I'm not sure how you are double checking the id but what I would do is use this command

Code: Select all

/script i=1 while UnitBuff( "player", i) ~= nil do name, __, __, ID = UnitBuff( "player", i) SendSystemChat(name.." "..ID) i = i + 1 end
That will list your buffs and ids.

Another option might be to use the buff name instead of the id. useGoodie uses ids so that it's universal but for your own use there is no reason why you couldn't use the name instead. The name of the item too for that matter.

Re: I keep getting this error

Posted: Wed Jun 08, 2011 10:50 am
by adonisz
ok so i got the ID from the goodie userfuction file and i fixed the name bydoing this
if (not player:hasBuff("Delicious Swamp Mix")) then
inventory:useItem(207203);
end
But it's still eating one swamp mix after killing one monster, not every 5 minutes. Could you show me a code that's supposed to work well?

Re: I keep getting this error

Posted: Wed Jun 08, 2011 10:44 pm
by rock5
If "Delicious Swamp Mix" is the name of the buff you see in the tooltip when you hover the mouse over it, then I don't know why it isn't working. Sorry. Unless you are using an older version of the bot.

Re: I keep getting this error

Posted: Wed Jun 08, 2011 11:42 pm
by adonisz
Could you post what you have in your profile if possible for eating housmaid potions and food?
Cuz this is the weirdest thing ever, when I fininshed eating Swamp mix after 50 fights (i had 50 swamp mixes and I ate one after every fight), I started consuming one lucky pot after one fight.......
I updated rombot to revision 605 and i have no idea how to fix this.... T.T. It was working fine before when I used to have goodie function in my profile, but the goodie fuction was causing my rombot to stop working.

Re: I keep getting this error

Posted: Thu Jun 09, 2011 12:11 am
by lisa
do you have more then 1 file with the same function in userfunctions folder?

Re: I keep getting this error

Posted: Thu Jun 09, 2011 6:46 am
by adonisz
nope i have catchcavy, gmmonitor, teleport, and usegoodie universal user fuctions all different in the folder

Re: I keep getting this error

Posted: Thu Jun 09, 2011 6:23 pm
by kanta
Are you using Delicious Swamp Mix or Housekeeper Special Delicious Swamp Mix? The buff IDs will be different, make sure you are getting the right one. Do these steps exactly:

1) Use one swamp mix to get buff
2) Use the following command in RoM, not in MM

Code: Select all

/script i=1 while UnitBuff( "player", i) ~= nil do name, __, __, ID = UnitBuff( "player", i) SendSystemChat(name.." "..ID) i = i + 1 end
3) Look in the "General" chat tab in RoM for a list of buffs with a number next to it, that is the ID# you need

Re: I keep getting this error

Posted: Thu Jun 09, 2011 7:50 pm
by rock5
And if they hadn't already done that as per my instructions then I'd say they deserve all the troubles they've had.

Re: I keep getting this error

Posted: Thu Jun 09, 2011 9:10 pm
by kanta
I remember helping him get going on the bot to begin with. I had to be pretty detailed in how things were said... This isn't to be taken as an insult by him, but he's even more of a newbie than I was when I started out.

Re: I keep getting this error

Posted: Thu Jun 09, 2011 9:25 pm
by rock5
Fair enough. But if he didn't understand something he should have asked for clarification. If he doesn't, all I can assume is he tried it but it didn't help.

Pretty much my hands are tied if people don't try the thing I ask them to try and act as if they did.

I do get the impression it should have been sorted by now.

By the way, Try my updated version of useGoodie. It might fix the problem.
http://www.solarstrike.net/phpBB3/viewt ... 952#p21952

Re: I keep getting this error

Posted: Sat Jun 11, 2011 1:35 pm
by adonisz
ahh sorry guys i am kind of noob and slow at learning things.
when rock5 first gave me the advice of /script i=1 while UnitBuff( "player", i) ~= nil do name, __, __, ID = UnitBuff( "player", i) SendSystemChat(name.." "..ID) i = i + 1 end, i didnt understand what he meant... T.T, that's why i had to ask again, but I got it to work now thanks to you guys.
sorry if i am slow at these kind of things :P.