Error while trying to use HP potion

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
muratiks
Posts: 22
Joined: Mon Dec 14, 2009 8:23 am

Error while trying to use HP potion

#1 Post by muratiks » Sun Sep 23, 2012 3:13 pm

rombot give this error when try to use hp potions. i have potions in both bags.

Image
Attachments
cantusehppot.jpg

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Error while trying to use HP potion

#2 Post by rock5 » Sun Sep 23, 2012 3:35 pm

Line numbers don't match up. Line 75 is

Code: Select all

	if not self.InUse then
No deltatime there. So maybe you have a corrupt rombot installation. Try Lisas sig instructions.
Can't get bot to work? follow these instructions before posting, thank you.
1. SVN update micromacro/scripts/rom folder
2. SVN revert micromacro/scripts/rom folder
3. delete Runes of Magic/Interface/Addons/ingamefunctions folder
4. copy micromacro/scripts/rom/devtools/ingamefunctions folder to Runes of Magic/Interface/Addons folder
5. restart game
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

BillDoorNZ
Posts: 446
Joined: Wed Aug 03, 2011 7:37 pm

Re: Error while trying to use HP potion

#3 Post by BillDoorNZ » Sun Sep 23, 2012 3:47 pm

hmm...thats an interesting one...

the code starting from line 75 (in my version at least) is :

Code: Select all

	if not self.InUse then
		if ( self.CoolDownTime > 0 and self.LastTimeUsed ~= 0 and
		( deltaTime( getTime(), self.LastTimeUsed ) / 1000 ) < self.CoolDownTime ) then -- Item is on CoolDown we can't use it
			canUse = false;
			reason = "Cooldown";
		end;
	else -- Item is in use, locked, we can't use it
		reason = "In use";
		canUse = false;
	end;

	if ( canUse ) then
		RoMScript("UseBagItem("..self.BagId..")");
		self.LastTimeUsed = getTime();
		yrest( 500 ); -- give time for server to respond with new item count
	else
		cprintf( cli.yellow, "DEBUG - Cannot use Item %s\t BagId: #%s ItemCount: %s\treason: %s\n", self.Name, self.BagId, self.ItemCount, reason );
		logMessage( sprintf( "DEBUG - Cannot use Item %s\t BagId: #%s ItemCount: %s\treason: %s\n", self.Name, self.BagId, self.ItemCount, reason ) );
	end;
obviously the error is on line 76 (the next line) where it is calling deltaTime(getTime(), self.LastTimeUsed)....and the LastTimeUsed must be nil. Not sure how that is happening, but if it is the first time the item is used, then that could be causing the problem - but only if the item is flagged as InUse as specified on the first line:

Code: Select all

	if not self.InUse then
So...did you manually use the potion while the bot was fighting? Or were you moving the item?

hmmm...after re-reading the code, I don't see how the LastTimeUsed value can ever be nil. It is set to 0 when the object is constructed and only ever changed in the CInventoryItem:use() function.

Does this happen every time? or was it a one-off occurrence?

muratiks
Posts: 22
Joined: Mon Dec 14, 2009 8:23 am

Re: Error while trying to use HP potion

#4 Post by muratiks » Sun Sep 23, 2012 3:58 pm

i did everything u said and got error same propblem

Image

muratiks
Posts: 22
Joined: Mon Dec 14, 2009 8:23 am

Re: Error while trying to use HP potion

#5 Post by muratiks » Sun Sep 23, 2012 4:15 pm

BillDoorNZ wrote:So...did you manually use the potion while the bot was fighting? Or were you moving the item?
i try and same error.

also bot doesnt start if hp lower than %90

<option name="HP_LOW_POTION" value="90" />

it happens everytime

Rompvp private server

BillDoorNZ
Posts: 446
Joined: Wed Aug 03, 2011 7:37 pm

Re: Error while trying to use HP potion

#6 Post by BillDoorNZ » Sun Sep 23, 2012 4:45 pm

very odd.

can you change the code in inventoryitem.lua at line 75 to:

Code: Select all

	if not self.InUse then
		printf("Item InUse: "..tostring(self.Name).." slot:"..tostring(self.SlotNumber).." bag:"..tostring(self.BagId).." LastTimeUsed:"..tostring(self.LastTimeUsed).."\n");
		if ( self.CoolDownTime > 0 and self.LastTimeUsed ~= 0 and
so, really, just adding that printf line in between the other two. This will probably spam you with lots of prints, but may point to the problem a bit more..or not :)

muratiks
Posts: 22
Joined: Mon Dec 14, 2009 8:23 am

Re: Error while trying to use HP potion

#7 Post by muratiks » Sun Sep 23, 2012 4:58 pm

Image

BillDoorNZ
Posts: 446
Joined: Wed Aug 03, 2011 7:37 pm

Re: Error while trying to use HP potion

#8 Post by BillDoorNZ » Sun Sep 23, 2012 5:27 pm

and you definitely went through the steps Rock outlined?
rock5 wrote:Line numbers don't match up. Line 75 is

Code: Select all

	if not self.InUse then
No deltatime there. So maybe you have a corrupt rombot installation. Try Lisas sig instructions.
Can't get bot to work? follow these instructions before posting, thank you.
1. SVN update micromacro/scripts/rom folder
2. SVN revert micromacro/scripts/rom folder
3. delete Runes of Magic/Interface/Addons/ingamefunctions folder
4. copy micromacro/scripts/rom/devtools/ingamefunctions folder to Runes of Magic/Interface/Addons folder
5. restart game
I'm asking, as I can't see any way that LastTimeUsed can be nil given the latest code. I thought the private servers ran off a different version of the bot? or an older version?

one thing you could try (to make it work for now) is changing the code to:

Code: Select all

	-- If the item can't be used now we should be able to set a timer or something like that to recall this function and check again...
	if not self.InUse then
		if ( self.CoolDownTime > 0 and self.LastTimeUsed ~= 0 and (self.LastTime)
		( deltaTime( getTime(), self.LastTimeUsed ) / 1000 ) < self.CoolDownTime ) then -- Item is on CoolDown we can't use it
(removing the debug line I gave you at the same time).

This may end up breaking things elsewhere, I'm not sure.

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Error while trying to use HP potion

#9 Post by lisa » Sun Sep 23, 2012 7:32 pm

BillDoorNZ wrote:and you definitely went through the steps Rock outlined?
rock5 wrote:Line numbers don't match up. Line 75 is

Code: Select all

	if not self.InUse then
No deltatime there. So maybe you have a corrupt rombot installation. Try Lisas sig instructions.
Can't get bot to work? follow these instructions before posting, thank you.
1. SVN update micromacro/scripts/rom folder
2. SVN revert micromacro/scripts/rom folder
3. delete Runes of Magic/Interface/Addons/ingamefunctions folder
4. copy micromacro/scripts/rom/devtools/ingamefunctions folder to Runes of Magic/Interface/Addons folder
5. restart game
Any time an item is defined with the item class the item.LastTimeUsed is defined as 0, the only way for it to be nil is if the bot is not the default bot and changes have been made or perhaps downloaded from another site where they made changes which obviously broke the bot, happened far to many times.

I guess there is 1 other possibility, getTime() is returning nil but in that line of code the getTime() isn't returning nil, only the LastTimeUsed is.

Just do a SVN update and SVN revert to the bot folder.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

muratiks
Posts: 22
Joined: Mon Dec 14, 2009 8:23 am

Re: Error while trying to use HP potion

#10 Post by muratiks » Mon Sep 24, 2012 4:00 am

i delete everything and download rombot update with svn and i have new error

Image

rompvp private server version 5.0.2.2565

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Error while trying to use HP potion

#11 Post by lisa » Mon Sep 24, 2012 4:11 am

That already looks better to me, something to note it says you are using micromacro v1.0
Current version is
MicroMacro v1.02 Beta 4

So yeah you need to update micromacro aswell =)

I should have looked at the join date, yeah a lot has changed since you last used the bot, so starting fresh is a very good idea. I doubt any of your old profiles would work, maybe even old waypoints might have an issue.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

muratiks
Posts: 22
Joined: Mon Dec 14, 2009 8:23 am

Re: Error while trying to use HP potion

#12 Post by muratiks » Mon Sep 24, 2012 4:23 am

thanks all.

its working now :P

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 45 guests