Page 1 of 1

How to switch to path when certain item amount is reached?

Posted: Tue Nov 02, 2010 7:10 am
by botje
like topic title explains, how would i switch to a new path file, for when i have collected 100 of a item?

i want to go drop it off, and empty bag and stock up on potions.

any help is appriciated ^^

Botje

Re: How to switch to path when certain item amount is reache

Posted: Tue Nov 02, 2010 7:36 am
by swietlowka
theres a problem with your point of view, when u use this function u can sometimes/all the time reach bull bagg, and dont loot no more untill u have x items, i use diffrent pattern and will share it with u :)

Code: Select all

occupiedSlots, totalSlots = sendMacro("GetBagCount();");
	if( occupiedSlots > 35 ) then
   loadPaths("crab_merchant");
end
when using that one when i reach a waypoint with it it check how much space i have in backpack and if more than 35 (example) it runs to the merchant

Re: How to switch to path when certain item amount is reache

Posted: Tue Nov 02, 2010 7:39 am
by botje
i see... yes , you have a point there :)

thanx, ill give this a shot ^^

Botje

Re: How to switch to path when certain item amount is reache

Posted: Tue Nov 02, 2010 8:18 pm
by rock5
Typically you can check a few things when deciding if you want to go to the merchant, eg. if I have 100 items or my backpack is getting too full or my main hand durability is low then go to merchant. It doesn't have to be just 1 check.

Re: How to switch to path when certain item amount is reache

Posted: Wed Nov 03, 2010 3:08 am
by botje
ok, cool, what about some examples for that then?

:)

Re: How to switch to path when certain item amount is reache

Posted: Wed Nov 03, 2010 3:49 am
by rock5
botje wrote:ok, cool, what about some examples for that then?

:)

Code: Select all

if inventory:itemTotalCount("itemname") > 99 or -- 100 or more items
        5 > inventory:itemTotalCount("<EMPTY>") or -- less than 5 spaces left in inventory
        50 > inventory:getMainHandDurability() then -- durability less than 50%
    loadPaths("crab_merchant");
end
BTW. I added being able to count empties recently. I think it was in rev 513.

Re: How to switch to path when certain item amount is reache

Posted: Wed Nov 03, 2010 3:51 am
by botje
thats so cool :D

im gonna try it right away ^^

thanx man :)

Botje

edit:

yeah dont worry, im always updated :)

Re: How to switch to path when certain item amount is reache

Posted: Wed Nov 03, 2010 5:53 am
by botje
seems something is wrong, maybe its me, or maybe its the code i dunno xd

Code: Select all

Wed Nov 03 11:47:49 2010 : ...ents/micromacro/scripts/rom/classes/waypointlist.lua:21: XML Parse Error.
File: ...nts/micromacro/scripts/rom/waypoints/Raven/crabs.xml
Line: 16
Column: 4
Pos: 846
Message: mismatched tag
Wed Nov 03 11:47:49 2010 : Execution error: Runtime error
Wed Nov 03 11:49:42 2010 : Executing script 'bot.lua'
and my waypoint file...

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
	<!-- #  1 --><waypoint x="9733" z="6716">	</waypoint>
	<!-- #  2 --><waypoint x="9997" z="6783">	</waypoint>
	<!-- #  3 --><waypoint x="10263" z="6973">	</waypoint>
	<!-- #  4 --><waypoint x="10337" z="7205">	</waypoint>
	<!-- #  5 --><waypoint x="10348" z="7409">	</waypoint>
	<!-- #  6 --><waypoint x="10144" z="7578">	</waypoint>
	<!-- #  7 --><waypoint x="9856" z="7627">	</waypoint>
	<!-- #  8 --><waypoint x="9607" z="7544">	</waypoint>
	<!-- #  9 --><waypoint x="9564" z="7389">	</waypoint>
	<!-- # 10 --><waypoint x="9547" z="7106">	</waypoint>
	<!-- # 11 --><waypoint x="9572" z="6886">	
	if inventory:itemTotalCount("Spawn of Earth Shell Crabs") > 99 or -- 100 or more items
 5 > inventory:itemTotalCount("<EMPTY>") or -- less than 5 spaces left in inventory
 50 > inventory:getMainHandDurability() then -- durability less than 50%
 loadPaths("Raven/CrabShop");
end
	</waypoint>
	<!-- # 12 --><waypoint x="9758" z="6672">	</waypoint>
</waypoints>

Re: How to switch to path when certain item amount is reache

Posted: Wed Nov 03, 2010 8:33 pm
by rock5
botje wrote:seems something is wrong, maybe its me, or maybe its the code i dunno xd
Mismatched tags usually happen when using '<'. The only '<' is in "<EMPTY>". I didn't think it would cause a problem in quotes but obviously it does. You can enclose the lua code in CDATA tags but an easier solution is to just use empty id instead of the name,

Code: Select all

5 > inventory:itemTotalCount(0)

Re: How to switch to path when certain item amount is reache

Posted: Thu Nov 04, 2010 6:14 am
by botje
ill try that when the server is back up :)

Botje