-
Germangold
- Posts: 276
- Joined: Thu Oct 22, 2009 3:58 am
#1
Post
by Germangold » Fri Nov 05, 2010 3:03 pm
Dear MM guys!
I have a problem regarding loading another path when there are only 3 spaces in bag left.
Following code is within a waypoint
Trigger for mainhands duration is allready set and working like a charm!
Code: Select all
(..)
if( inventory:getItemCount(0) > 58 ) then
loadPaths("ravenfell_sellnpcl"); end
Isnt it true that inventory:getItemCount(0) returns the value of total items occupied in the bag?
How can i solve my problem?
Last edited by
Germangold on Sat Nov 06, 2010 3:46 pm, edited 1 time in total.
-
jduartedj
- Posts: 599
- Joined: Sat Dec 19, 2009 12:18 am
- Location: Lisbon
-
Contact:
#2
Post
by jduartedj » Fri Nov 05, 2010 6:01 pm
Germangold wrote:Dear MM guys!
I have a problem regarding loading another path when there are only 3 spaces in bag left.
Following code is within a waypoint
Trigger for mainhands duration is allready set and working like a charm!
Code: Select all
(..)
if( inventory:getItemCount(0) > 58 ) then
loadPaths("ravenfell_sellnpcl"); end
Isnt it true that inventory:getItemCount(0) returns the value of total items occupied in the bag?
How can i solve my problem?
HI!
You have 2 issues here.... lets analyze!
1. did you test inventory:getItemCount(0) ? try printf(inventory:getItemCount(0));
--> It returns the number of empty spaces, thus it solves your problem!
2. If it returned the number of occupied slot it would work fine if you have a 60 items back, to account for any bagsize you should use a variable that gives you the bag sizea dn decrease it by 3 instead of "58".
Use:
Code: Select all
if( inventory:getItemCount(0) < 4 ) then
loadPaths("ravenfell_sellnpcl");
end
EDIT: I'm guessing 0 stands for "Empty space" item-ID.
-
rock5
- Posts: 12173
- Joined: Tue Jan 05, 2010 3:30 am
- Location: Australia
#3
Post
by rock5 » Fri Nov 05, 2010 9:56 pm
jduartedj wrote:Code: Select all
if( inventory:getItemCount(0) < 4 ) then
loadPaths("ravenfell_sellnpcl");
end
Because of the '<' symbol that probably wont work. You can just flip it around, though, like this.
Code: Select all
if( 4 > inventory:getItemCount(0) ) then
loadPaths("ravenfell_sellnpcl");
end
jduartedj wrote:EDIT: I'm guessing 0 stands for "Empty space" item-ID.
That is correct. getItemCount can accept a name or id but because empties have a '<' symbol in their names ("<EMPTY>") using the name will cause problems so we can just use the empty id, which is "0", instead.
- 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.”
-
jduartedj
- Posts: 599
- Joined: Sat Dec 19, 2009 12:18 am
- Location: Lisbon
-
Contact:
#4
Post
by jduartedj » Fri Nov 05, 2010 11:13 pm
Thx for that correction, rock!
I didn't know that lua didn't support that symbol because I never used it in lua, yet it seemed logical that if > worked then < would too. But thanks for that!
Hope you have a better botting XP now, Gold!
-
rock5
- Posts: 12173
- Joined: Tue Jan 05, 2010 3:30 am
- Location: Australia
#5
Post
by rock5 » Fri Nov 05, 2010 11:30 pm
Lua supports '<' just fine so you can use them in .lua documents. It is because it is in an .xml document that it causes trouble. It gets interpreted as a beginning of a tag so you get a "malformed tag" error.
There are 2 ways to avoid it.
1. Use CDATA tags eg.
Code: Select all
<waypoint x="nnnn" z="nnnnn"><![CDATA[
-- Lua code here with '<' symbols
]]></waypoint >
2. Or just flip the condition around so instead of
you use
Or instead of using
you use
- 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.”
-
Germangold
- Posts: 276
- Joined: Thu Oct 22, 2009 3:58 am
#6
Post
by Germangold » Sat Nov 06, 2010 3:47 pm
thanks guys!
new implemented code works like a cHARM
Who is online
Users browsing this forum: No registered users and 7 guests