Page 1 of 1

(HELP) Question about checking backpack item status

Posted: Thu Apr 19, 2012 8:49 am
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?

Re: (HELP) Question about checking backpack item status

Posted: Thu Apr 19, 2012 9:15 am
by rock5
Try

Code: Select all

if ( inventory:itemTotalCount(0, "bag3") < 5 ) then 
   loadPaths("Sardo_repair")
end

Re: (HELP) Question about checking backpack item status

Posted: Thu Apr 19, 2012 12:40 pm
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

Re: (HELP) Question about checking backpack item status

Posted: Thu Apr 19, 2012 1:17 pm
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.