Page 1 of 2

Disenchant Dealer

Posted: Sat Dec 08, 2012 7:23 am
by Turbomuemmel
Hello
want from the dealer purchased true Disenchant
my waypoint file error reports

Re: Disenchant Dealer

Posted: Sat Dec 08, 2012 10:50 am
by rock5
I saw 3 problems.

1. You have the start of waypoint but then you do all the code in the onload.
2. There was no closing onload tag "</onLoad>".
3. We usually use the empty slots id (0) to count empties because the name "<EMPTY>" gets interpreted as a tag in xml files. You can use that in lua files but it's best to just get in the habit of using 0.

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
		player:openStore("Shamp", _option);

		-- inventory:update() -- not needed. getItemCount updates the inventory.
		-- while inventory:getItemCount("Lehrlingslangstiefel") > inventory:itemTotalCount(0,"bags")-- not sure what you mean here
		while 1 > inventory:itemTotalCount(0,"bags") do -- fills bag with items
		   inventory:storeBuyItem("Lehrlingslangstiefel");
		end
	
		while ( inventory:getItemCount("Lehrlingslangstiefel") > 0 ) do
		   -- run disenchant macro... not sure what to use for this
		   -- Find some boots
		   local boots = inventory:findItem("Lehrlingslangstiefel")
		   -- Use Disenchant skill
		   RoMScript("UseSkill(1,3)") -- Make sure your Disenchant is on tab 1, skill 3.
		   -- Clicks the item
		   RoMScript("PickupBagItem("..boots.BagId..")") 
		   rest( 3550 );
		end
</onLoad>
</waypoints>

Re: Disenchant Dealer

Posted: Thu Dec 20, 2012 3:26 am
by startxkdm
-

Re: Disenchant Dealer

Posted: Thu Dec 20, 2012 3:49 am
by rock5
The error message just means it finished the onload code and tried to go to a waypoint but there aren't any. If you are going to have an onload only waypoint file then the onload should never finish or it should end when it's finished with an "error" command.

I think what you want to do is put the whole thing a loop. You could just use a generic loop that loops for ever, eg

Code: Select all

while true do
   ...
end
or

Code: Select all

repeat
   ...
until false
Or you could loop until you can't disenchant anymore. I'm not sure what you would check. Maybe if you run out of money or bag space because it's full of runes.

Try encircling the whole thing with

Code: Select all

repeat
   ...
until inventory:itemTotalCount(0) == 0 or 10 > inventory.Money
error("Finished disenchanting")

Re: Disenchant Dealer

Posted: Thu Dec 20, 2012 4:15 am
by startxkdm
-

Re: Disenchant Dealer

Posted: Thu Dec 20, 2012 4:32 am
by rock5

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
      repeat

      player:openStore("Mallor", _option);

      -- inventory:update() -- not needed. getItemCount updates the inventory.
      -- while inventory:getItemCount("Rusted Axe") > inventory:itemTotalCount(0,"bags")-- not sure what you mean here
      while inventory:itemTotalCount(0,"bags") > 1 do -- fills bag with items
         inventory:storeBuyItem("Rusted Axe");
      end
   
      while ( inventory:getItemCount("Rusted Axe") > 0 ) do
         -- run disenchant macro... not sure what to use for this
         -- Find some boots
         local boots = inventory:findItem("Rusted Axe")
         -- Use Disenchant skill
         RoMScript("UseSkill(1,3)") -- Make sure your Disenchant is on tab 1, skill 3.
         -- Clicks the item
         RoMScript("PickupBagItem("..boots.BagId..")")
         rest( 3550 );
      end

      until inventory:itemTotalCount(0) == 0 or 10 > inventory.Money
      error("Finished disenchanting")
</onLoad>
</waypoints>
What that code I posted does is check both if you are out of space and if you are out of money.

I noticed a mistake with this line and fixed it.

Code: Select all

      while 1 > inventory:itemTotalCount(0,"bags") do -- fills bag with items

Re: Disenchant Dealer

Posted: Thu Dec 20, 2012 4:49 am
by startxkdm
-

Re: Disenchant Dealer

Posted: Thu Dec 20, 2012 6:56 pm
by startxkdm
-

Re: Disenchant Dealer

Posted: Thu Dec 20, 2012 8:10 pm
by rock5
I'm not sure why you got the "boot" issue. It's probably a matter of timing. You just need to check "boot before using it. Try changing the following

Code: Select all

         -- Find some boots
         local boots = inventory:findItem("Rusted Axe")
         -- Use Disenchant skill
         RoMScript("UseSkill(1,3)") -- Make sure your Disenchant is on tab 1, skill 3.
         -- Clicks the item
         RoMScript("PickupBagItem("..boots.BagId..")")
         rest( 3550 );
to

Code: Select all

         -- Find some boots
         local boots = inventory:findItem("Rusted Axe")
         if boots then
            -- Use Disenchant skill
            RoMScript("UseSkill(1,3)") -- Make sure your Disenchant is on tab 1, skill 3.
            -- Clicks the item
            RoMScript("PickupBagItem("..boots.BagId..")")
            rest( 3550 );
         end

Re: Disenchant Dealer

Posted: Thu Dec 20, 2012 8:36 pm
by startxkdm
-

Re: Disenchant Dealer

Posted: Thu Dec 20, 2012 8:46 pm
by lisa
replace

Code: Select all

      while inventory:itemTotalCount(0,"bags") > 1 do -- fills bag with items
         inventory:storeBuyItem("Rusted Axe");
      end
with

Code: Select all

local buy = inventory:itemTotalCount(0,"bags") - 1
store:buyItem("Rusted Axe", buy)
7:37pm - C:/micromacro/scripts/rom/classes/waypointlist.lua:83: Failed to compile and run Lua code for waypointlist onLoad event.
That means you messed up somewhere, can't tell you what is wrong unless you post all of the onload code.

Re: Disenchant Dealer

Posted: Thu Dec 20, 2012 8:57 pm
by startxkdm
-

Re: Disenchant Dealer

Posted: Thu Dec 20, 2012 9:14 pm
by lisa
repeat

player:openStore("Mallor", _option);

-- inventory:update() -- not needed. getItemCount updates the inventory.
-- while inventory:getItemCount("Rusted Axe") > inventory:itemTotalCount(0,"bags")-- not sure what you mean here
local buy = inventory:itemTotalCount(0,"bags") - 1
store:buyItem("Rusted Axe", buy)
end
that will always crash 100%
repeat
........
end
will never work

try this

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
	repeat
		player:openStore("Mallor", _option);
		local buy = inventory:itemTotalCount(0,"bags") - 1
		store:buyItem("Rusted Axe", buy)
		while ( inventory:getItemCount("Rusted Axe") > 0 ) do
			inventory:update()
			local boots = inventory:findItem("Rusted Axe")
			if boots then
				-- Use Disenchant skill
				RoMScript("UseSkill(1,3)") -- Make sure your Disenchant is on tab 1, skill 3.
				-- Clicks the item
				RoMScript("PickupBagItem("..boots.BagId..")")
				rest( 3550 );
			end
		end
	until inventory:itemTotalCount(0) == 0 or 10 > inventory.Money
	error("Finished disenchanting")
</onLoad>
</waypoints>

Re: Disenchant Dealer

Posted: Thu Dec 20, 2012 9:15 pm
by startxkdm
-

Re: Disenchant Dealer

Posted: Thu Dec 20, 2012 9:18 pm
by startxkdm
-

Re: Disenchant Dealer

Posted: Thu Dec 20, 2012 9:20 pm
by lisa
yeah I edited it, try it again with what is posted now.

Re: Disenchant Dealer

Posted: Thu Dec 20, 2012 9:23 pm
by startxkdm
-

Re: Disenchant Dealer

Posted: Thu Dec 20, 2012 9:37 pm
by rock5
I didn't get a compile error so maybe it's something else such as a userfunction or something.

Re: Disenchant Dealer

Posted: Thu Dec 20, 2012 9:45 pm
by startxkdm
-

Re: Disenchant Dealer

Posted: Thu Dec 20, 2012 10:01 pm
by startxkdm
-