(HELP) Question about checking backpack item status

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
greenmachine
Posts: 7
Joined: Wed Sep 07, 2011 11:05 am

(HELP) Question about checking backpack item status

#1 Post by greenmachine »

OK, so I have been able to split what I need between three waypoint files, and they transition correctly, and the waypoint sells to a vender correctly. I however have a problem with it checking my inventory the way I need/want it to.
Waypoint, the first: This waypoint is my main botting waypoint. It is in this file I have it check for durability and total number of empty slots. The durability check works as far as I know, but should be unneccessary since my back pack should be filling up much faster than my weapon will be going down. My code for the items check is this:

Code: Select all

if 35 > inventory:itemTotalCount(0) then 
	loadPaths("Sardo_repair")
end
I am doing it this way because I can't get it to do what I want it to do. This works.

What I want it to do: I want it to check JUST bags 1, 2, and 3; then if there is less than 5 spaces, go sell.
I have 4 bags and I would like to keep my potions and arrows, and misc items in the 4th backpack and have it not factored into the item count.

After reading a bit on the forum, I came up with the following:

Code: Select all

if ( inventory:itemTotalCount(0, bag3) < 5 ) then 
	loadPaths("Sardo_repair")
end
I got the range code from the RoM Functions page of the SolarWiki

Code: Select all

inventory:itemTotalCount(itemNameOrId, range)
This, however, does not seem to check bag 3 as I had hoped. I just wanted it to check bag 3 because it will be the last of my 3 backpacks to fill up, making it unnecessary to check the first 2.

Any tips from some seasoned code junkies?
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: (HELP) Question about checking backpack item status

#2 Post by rock5 »

Try

Code: Select all

if ( inventory:itemTotalCount(0, "bag3") < 5 ) then 
   loadPaths("Sardo_repair")
end
  • 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
greenmachine
Posts: 7
Joined: Wed Sep 07, 2011 11:05 am

Re: (HELP) Question about checking backpack item status

#3 Post by greenmachine »

Unfortunately that did not work. It is giving me an error at line 10, column 42.
Using Notepad++, that brings me to the greater than/less than sign.
Message: not well-formed <invalid token>

So I thought back to my first try and decided to put the operator at the beginning.

Such as:

Code: Select all

if 5 > inventory:itemTotalCount(0,"bag3") then
   loadPaths("Sell_repair")
end
This worked. I hope this helps anyone else looking for such a solution.

Many thanks go to rock, who pointed out that I need to remember to use quotes! :oops: :P
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: (HELP) Question about checking backpack item status

#4 Post by rock5 »

I thought it was possible you were using

Code: Select all

<![CDATA[
   ...
]]>
That would also allow you to use <. Otherwise I would have mentioned it. I did notice it :D

For your future reference there is one more solution. It's a sequence of characters that represents < but I always forget what they are. Something like "<".

I just do what you did, flip them around. Easiest solution.
  • 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
Post Reply