Page 1 of 1

Simple Item count problem

Posted: Wed Nov 18, 2009 11:41 am
by Tarsi
Hi,

I'm trying to call a waypoint file based on an item count. Here my code:
<waypoints>
<!-- # 1 --><waypoint x="-547" z="-5968">
inventory:update();

if ( inventory:itemTotalCount("Phiriusmarke") < 90 ) then

load_paths("dailypfad.xml");

else
load_paths("arkanholen.xml");

end
</waypoint>
</waypoints>
Looks simple and straightforward to me . However the bot quits with an
Line: 5
Column: 49
Message: not well-formed (invalid token)
It's probably a simple thing but I can't find the solution. Could somebody help me out here?

RGDS

tarsi

Re: Simple Item count problem

Posted: Wed Nov 18, 2009 4:30 pm
by Administrator
Don't use '<' within a tag; it confuses the parser (it can't tell between you using it in code, and using it to create a new tag). Use '&lt' instead.

Re: Simple Item count problem

Posted: Wed Nov 18, 2009 6:24 pm
by Tarsi
Ok, thanx, I will try that wicked sign of yours :)

By the way, I think somebody should have a look at the Wiki if this turns out to be the problem as I copied the string from teh tutorial examples :)

Will report effect tomorrow...

Thanx

tarsi

Re: Simple Item count problem

Posted: Fri Nov 20, 2009 4:56 am
by Tarsi
Hi again,

hm, I still get the same failure message with
<waypoints>
<!-- # 1 --><waypoint x="-547" z="-5968">
inventory:update();

if ( inventory:itemTotalCount("Phiriusmarke") &lt 90 ) then

load_paths("dailypfad.xml");

else
load_paths("arkanholen.xml");

end
</waypoint>
</waypoints>
XML Parse Error
Line: 5
Column: 51
Message: not well-formed (invalid token)

Any other ideas?

Thx

Tarsi

Re: Simple Item count problem

Posted: Fri Nov 20, 2009 5:02 pm
by Administrator
My mistake. It should be "<" and not just "&lt". Let me know if this works.

Re: Simple Item count problem

Posted: Mon Nov 23, 2009 1:48 pm
by Tarsi
Hi,

thanx a lot, this now works. Another question came up though - how do I set a count for an item with a german Umlaut?
if ( inventory:itemTotalCount("Scharfe Bärenklaue") > 4 ) then
loadPaths("baerenabgeben.xml");
I tried with \132; instead of the ä but it didn't seem to have the desired effect. The bot accepted the code but didn't og into into the "then" part.

thx for the help...

Tarsi

Re: Simple Item count problem

Posted: Tue Nov 24, 2009 3:32 am
by raff
i dont know how to get umlauts working, but instead of itemnames, you can take the itemid. item ids can be found on this site:

www.runesdb.com <- but only for english itemnames
http://romdata.buffed.de <- for german itemnames