Page 1 of 1

New AT Charges

Posted: Wed Aug 31, 2016 4:09 am
by Ynot
I want to buy AT charges (ItemID= 202928) from the Phirius Merchant "Angus" outside the Varanas Auction House, but I can get no further than opening the Chat Window. I am new to Coding and would appreciate any assistance with this. :?:

Re: New AT Charges

Posted: Wed Aug 31, 2016 5:30 pm
by Bill D Cat
Ynot wrote:I want to buy AT charges (ItemID= 202928) from the Phirius Merchant "Angus" outside the Varanas Auction House, but I can get no further than opening the Chat Window. I am new to Coding and would appreciate any assistance with this. :?:
Here you go.

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
	<onload>
		if not __WPL.ResumePoint then
			__WPL:setWaypointIndex(1)
			_target = player:findNearestNameOrId(110432) -- Angus
			if not _target then
				error("Not near NPC Angus in Varanas Central.",0)
			end
		end
	</onload>
	<!-- #  1 --><waypoint x="5167" z="-1909" y="132">
		player:target_NPC(110432) -- Angus
		ChoiceOptionByName(getTEXT("ITEMSHOP_CATEGORY_UPGRADING")) -- 'Upgrading'
		store:buyItem(202928,1) -- 10 Arcane Transmutor Charges for 100 Phirius Token Coins
		RoMScript("StoreFrame:Hide()")
		error("We bought 10 AT Charges!",0)
	</waypoint>
</waypoints>

Re: New AT Charges

Posted: Mon Sep 05, 2016 1:18 pm
by Ynot
Thanks Bill, I was begining to despair :D

Re: New AT Charges

Posted: Mon Oct 03, 2016 3:26 am
by Ynot
Guys..I'm stuck with this. I cannot make my character use the AT Charges puchased from NPC Angus in Varanas Central.
I have used in various different ways:

Code: Select all

inventory:useItem("202928")
and even:

Code: Select all

if inventory:itemTotalCount("202928") >0 then
         	repeat
        	 inventory:useItem("202928")
        	 yrest(100)
        	 inventory:update()
       	 	until inventory:itemTotalCount("202928") == 0
end
but, nothing seems to work. I am using the latest patch on a public server wth MM 1.05.207 with update to 787. Am I missing something?

Re: New AT Charges

Posted: Mon Oct 03, 2016 7:03 am
by Bill D Cat
Just get rid of the quotes around the numbers: inventory:useItem(202928)

You only need the quotes if the characters are alpha-numeric like the item name itself. You don't need them if you are using the item's ID number.

Re: New AT Charges

Posted: Fri Oct 07, 2016 3:27 am
by Ynot
Thanks Bill. been away a few days but, finally got a chance to try it out without quotes. However, I get
2016-10-07 09:12:41 - [string "..."]:10: attempt to call global 'itemTotalCount' (a nil value)
Here is the full coding

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
   <onload>
      if not __WPL.ResumePoint then
         __WPL:setWaypointIndex(1)
         _target = player:findNearestNameOrId(110432) -- Angus
         if not _target then
            error("Not near NPC Angus in Varanas Central.",0)
         end
      end
	  
   </onload>
   <!-- #  1 --><waypoint x="5171" z="-1890" y="137">
      player:target_NPC(110432) -- Angus
      ChoiceOptionByName(getTEXT("ITEMSHOP_CATEGORY_UPGRADING")) -- 'Upgrading'
		store:buyItem(202928,4) -- 10 Arcane Transmutor Charges for 100 Phirius Token Coins
      RoMScript("CloseAllWindows()")
		
	if inventory:itemTotalCount(202928) >0 then
   
         repeat
         print( "total item = ", itemTotalCount(202928))
         inventory:useItem(202928)
         yrest(100)
         inventory:update()
        until inventory:itemTotalCount(202928) == 0
	end

		loadPaths("Makefusion.xml")
		</waypoint>
</waypoints>
I have also tried puting the If statement into the onload section but with the same result.
Putting the quotes back in, results in the processes missing the "useitem" section completely and proceeds to load the next waypoint file. Been scratching my head so hard on this problem I now have Scars :lol:

Re: New AT Charges

Posted: Fri Oct 07, 2016 7:13 am
by Bill D Cat
Ynot wrote:Thanks Bill. been away a few days but, finally got a chance to try it out without quotes. However, I get
2016-10-07 09:12:41 - [string "..."]:10: attempt to call global 'itemTotalCount' (a nil value)
Well that's a simple fix. The command is inventory:itemTotalCount(). See my notes in your code below.
Ynot wrote:Here is the full coding

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
   <onload>
      if not __WPL.ResumePoint then
         __WPL:setWaypointIndex(1)
         _target = player:findNearestNameOrId(110432) -- Angus
         if not _target then
            error("Not near NPC Angus in Varanas Central.",0)
         end
      end
	  
   </onload>
   <!-- #  1 --><waypoint x="5171" z="-1890" y="137">
      player:target_NPC(110432) -- Angus
      ChoiceOptionByName(getTEXT("ITEMSHOP_CATEGORY_UPGRADING")) -- 'Upgrading'
		store:buyItem(202928,4) -- 10 Arcane Transmutor Charges for 100 Phirius Token Coins
      RoMScript("CloseAllWindows()")
		
	if inventory:itemTotalCount(202928) >0 then    --  It is correct here
   
         repeat
         print( "total item = ", itemTotalCount(202928))  -- It is incorrect here.  Needs the inventory: prefix.
         inventory:useItem(202928)
         yrest(100)
         inventory:update()
        until inventory:itemTotalCount(202928) == 0    --  It is correct here
	end

		loadPaths("Makefusion.xml")
		</waypoint>
</waypoints>
I have also tried puting the If statement into the onload section but with the same result.
Putting the quotes back in, results in the processes missing the "useitem" section completely and proceeds to load the next waypoint file. Been scratching my head so hard on this problem I now have Scars :lol:

Re: New AT Charges

Posted: Sat Oct 08, 2016 6:41 pm
by Ynot
Thanks again Bill. I haven't had a chance to try it out yet but, I will get back you and let you know how it went. :D

Re: New AT Charges

Posted: Tue Oct 11, 2016 10:42 pm
by Ynot
That worked :D I could not see the obvious if it smacked me in the face with a frying pan :lol: mamy thanks