triggers wtih Inventory:getItemCount wont work

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Germangold
Posts: 276
Joined: Thu Oct 22, 2009 3:58 am

triggers wtih Inventory:getItemCount wont work

#1 Post by Germangold »

hy guys

strange problem
i used to autosell my items when bagspace is all occupied like this

Code: Select all

if (inventory:getItemCount(0) < 6) then -- goto repairs, less then 6 slots aviable
__WPL:setWaypointIndex(__WPL:findWaypointTag("repairs")); 	 
end
but it wont work for me anymore

svn is 670 newest one

then i tried this

Code: Select all

_emptyspace = inventory:getItemCount(0);
printf("Your empty bagspace is:\n ", _emptyspace);
but wont really retunr anything:
Your empty bagspace is:
is a blank space
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: triggers wtih Inventory:getItemCount wont work

#2 Post by rock5 »

I never used < myself but I just did a bit of testing. Looks like you can only use it in xml files and NOT between <![CDATA[ and ]]> tags. Are you posibly trying to use it between those tags or in an lua file?
  • 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
Germangold
Posts: 276
Joined: Thu Oct 22, 2009 3:58 am

Re: triggers wtih Inventory:getItemCount wont work

#3 Post by Germangold »

hi rock5
i am using it inbeetwen a waypoint

Code: Select all

<!-- # 88 --><waypoint x="-11510" z="42556" y="709"> 
	

	 if (inventory:getItemCount(0) < 6) then -- goto repairs, less then 6 slots aviable
		__WPL:setWaypointIndex(__WPL:findWaypointTag("repairs")); 	 
	 end
	
	__WPL:setWaypointIndex(__WPL:findWaypointTag("fromthestart")); 	 	</waypoint>
	-- repairs
	<!-- # 16 --><waypoint x="-11352" z="42478" y="721" tag="repairs"></waypoint>
	<!-- # 15 --><waypoint x="-11479" z="42522" y="717">	</waypoint>	
	<!-- # 14
this waypoint filed worked really fine before
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: triggers wtih Inventory:getItemCount wont work

#4 Post by rock5 »

That doesn't look right. The thing you have to understand is if you change the waypoint index, or even load a new waypoint file, the rest of the code at the waypoint will still finish being executed.

So in your example above, if you have less than 6 spaces left it changes to the "repairs" waypoint but then immediately changes it to "fromthestart" regardless. If you use an "if then else end" construct that would fix it but if the repairs path immediately follows that code, I would write it like this.

Code: Select all

	<!-- # 88 --><waypoint x="-11510" z="42556" y="709"> 
	if (inventory:getItemCount(0) > 5) then -- Still got space, go again
		__WPL:setWaypointIndex(__WPL:findWaypointTag("fromthestart"));
	end
	</waypoint>

	-- repairs
   <!-- # 16 --><waypoint x="-11352" z="42478" y="721"></waypoint>
   <!-- # 15 --><waypoint x="-11479" z="42522" y="717">   </waypoint>   
   <!-- # 14
  • 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