Page 1 of 1

Integrate Macro: Equip Mainhand and Offhand

Posted: Sat Mar 24, 2012 11:17 am
by grande
Greetings. I have this macro to equip my mainhand and offhand from my bag items. Can anyone tell me how to integrate it to the code below?

This is the macro:

Code: Select all

/run EquipItem(16) EquipItem(17) mh,offh = nil,nil
/run _,_,ts=GetBagCount() for i=1,ts do ii,_,n=GetBagItemInfo(i) if n=="Name of Offhand goes here" then offh=ii elseif n=="Name of Mainhand goes here" then mh = ii end end
/run EquipItem(16, mh) EquipItem(17, offh)
This is my WP I want the macro to work in:

Code: Select all

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

   --== User Option ==--
      startGMDetect()

   __WPL:setWaypointIndex(1);
</onLoad>
	<!-- #  1 --><waypoint x="-xxxx" z="xxxx" y="xxx">
		repeat
		     player:target_Object("Mailbox"); yrest(1000); -- mailbox
		until RoMScript("SpeakFrame:IsVisible()")
		repeat
		     sendMacro("ChoiceOption(1);"); yrest(1000);
			until RoMScript("MailFrame:IsVisible()")
			UMM_TakeMail (); 
			yrest(2000);
			RoMScript("UMMFrame:Hide()");
			yrest(300);
			inventory:useItem("Name of Bow")
			inventory:useItem("Name of Leggings")
			inventory:useItem("Name of Chest Armor")
                                          -- hoping to insert equip offhand/mainhand macro here	
</waypoint>
	<!-- #  2 --><waypoint x="xxxx" z="xxxx" y="-xx">	</waypoint>
	<!-- #  3 --><waypoint x="xxxx" z="xxxx" y="xxx">	</waypoint>
	<!-- #  4 --><waypoint x="xxxx" z="xxxx" y="xxx">		loadPaths("Name of Path")
	</waypoint>
</waypoints>
Thanks :-)

Re: Integrate Macro: Equip Mainhand and Offhand

Posted: Sun Mar 25, 2012 6:42 pm
by grande
Anyone?

Re: Integrate Macro: Equip Mainhand and Offhand

Posted: Sun Mar 25, 2012 8:54 pm
by lisa
So you just want to equip an item??

Code: Select all

inventory:useItem(212236)
or

Code: Select all

inventory:useItem("Rune Catapult")
if you want to use those in game functions then use RoMScript

Code: Select all

RoMScript("EquipItem(16)")
yrest(500)
RoMScript("EquipItem(17)")

Re: Integrate Macro: Equip Mainhand and Offhand

Posted: Sun Mar 25, 2012 9:00 pm
by grande
Lisa the problem with that your suggestion is it doesn't consider offhand vs mainhand therefore only the mainhand would ever wield a weapon. The nice thing about the macro is that it equips both. My problem is that I can't figure out how to make the bot do it. I thought about and tried several variations of /romscript but I don't get the syntax.

Re: Integrate Macro: Equip Mainhand and Offhand

Posted: Sun Mar 25, 2012 9:18 pm
by lisa

Code: Select all

RoMScript("EquipItem(16)")
yrest(500)
RoMScript("EquipItem(17)")
local mhitem = inventory:findItem(itemNameOrId)
local ohitem = inventory:findItem(itemNameOrId)
RoMScript("EquipItem(16, "..mhitem.SlotNumber..")")
yrest(500)
RoMScript("EquipItem(17, "..ohitem.SlotNumber..")")
Just change the itemNameOrId to what item you want to use for each.
mhitem is obviously main hand
ohitem is obviously offhand

Re: Integrate Macro: Equip Mainhand and Offhand

Posted: Sun Mar 25, 2012 9:42 pm
by grande
You're awesome Lisa. That will save me a lot of ass pain later on so I don't have to make macros and set them up for each character. Thx again!

Re: Integrate Macro: Equip Mainhand and Offhand

Posted: Sun Apr 01, 2012 5:21 pm
by grande
Lisa, it wasn't working with the code you gave so I did more looking around and it turns out I need "BagID" instead of "SlotNumber"

This worked:

Code: Select all

			RoMScript("EquipItem(16)");
			yrest(500);
			RoMScript("EquipItem(17)");
			yrest(500);
			local mhitem = inventory:findItem("Name-Of My MH item");
			RoMScript("EquipItem(16,"..mhitem.BagId..")");
			yrest(800);
			local ohitem = inventory:findItem("Name-Of OH item");
			RoMScript("EquipItem(17,"..ohitem.BagId..")");
			yrest(800);