WoW:Item equipping
Basics
/script PickupContainerItem(bag, slot)
bag goes from 0 to 4 (0 being your backpack). slot goes from 1 to the number of slots in that bag (left to right, top to bottom).
The basic command. Works like this:
- If no item in cursor:
- If item in bag:slot - picks up the item and puts it on the cursor.
- If no item in bag:slot - does nothing
- If item on cursor
- If item in bag:slot - switches the item in the bag:slot with the one on the cursor.
- If no item in bag:slot - puts down item from cursor into bag:slot
/script PickupInventoryItem(inventorySlot)
Picks up/puts down/switches item into the specified slot.
See InventorySlots for ids and mappings.
Better method:
/script UseContainerItem(bag, slot);
Will automatically equip the item referenced by bag,slot, placing any existing already equipped item in the bag slot.
Yes, this is undoubtedly easier... until you start dealing with dualwielding. At which point UseContainerItem stops being nice. -- Sarf
Multiple commands
There is a problem when executing multiple Pickup commands because they execute instantaneously on your client, which is not always synched with the server.
Therefore, follow these simple guidelines:
- Check if the cursor has an item on it and execute all your pickup commands on the same line.
Example:
if ( not CursorHasItem() ) then PickupContainerItem(...); ... end - Pickup items once, and drop them once for one macro.
Good luck!
Weapon swapping scripts
NOTE: When copying the scripts, make sure they end up on ONE line. Also, you will NEED to change the offhandBag, offhandBagSlot and mainhandBag, mainhandBagSlot names to actual numbers, as the scripts will NOT fit in a macro as it is.
From mainhand/offhand to mainhand/offhand
Script to swap items in both hands to other items in both hands. offhandBag, offhandBagSlot and mainhandBag, mainhandBagSlot need to be specified (duh).
/script if ( not CursorHasItem() ) then PickupContainerItem(mainhandBag, mainhandBagSlot); PickupInventoryItem(16); PickupContainerItem(mainhandBag, mainhandBagSlot); PickupContainerItem(offhandBag, offhandBagSlot); PickupInventoryItem(17); PickupContainerItem(offhandBag, offhandBagSlot); end
From mainhand to mainhand/offhand
Script to switch from item in main hand to other items in both hands. offhandBag, offhandBagSlot and mainhandBag, mainhandBagSlot need to be specified (duh). Weapon in main hand will end up in mainhandBag, mainhandBagSlot.
/script if ( not CursorHasItem() ) then PickupContainerItem(mainhandBag, mainhandBagSlot); PickupInventoryItem(16); PickupContainerItem(mainhandBag, mainhandBagSlot); PickupContainerItem(offhandBag, offhandBagSlot); PickupInventoryItem(17); if ( CursorHasItem() ) then PickupContainerItem(offhandBag, offhandBagSlot); end end
From mainhand/offhand to mainhand
Script to switch from items in both hands to one item in the main hand. offhandBag, offhandBagSlot and mainhandBag, mainhandBagSlot need to be specified (duh). Weapons will end up on the slots specified.
/script if ( not CursorHasItem() ) then PickupInventoryItem(17); if ( CursorHasItem() ) then PickupContainerItem(offhandBag, offhandBagSlot); end PickupContainerItem(mainhandBag, mainhandBagSlot); PickupInventoryItem(16); PickupContainerItem(mainhandBag, mainhandBagSlot); end
From mainhand to mainhand
Script to switch from item in main hand to another item in the main hand. mainhandBag, mainhandBagSlot need to be specified (duh). The equipped weapon will end up on mainhandBag, mainhandBagSlot.
/script if ( not CursorHasItem() ) then PickupContainerItem(mainhandBag, mainhandBagSlot); PickupInventoryItem(16); PickupContainerItem(mainhandBag, mainhandBagSlot); end
With Cosmos
If you are using Cosmos, you can use the following commands :
/equip <Item Name> /unequip <Item Name> /saveset <Number> /loadset <Number>