PDA

View Full Version : CursorHasItem, can you drop the item?


Munson
11-27-2004, 03:15 PM
I have made some macros for switching weapons, but I have run into some problems.

If you have a item on the cursor already, that item will be switched with the item I pick up from my inventory (which I dont want). Can you either find the first empty inv slot or just simulate a right click to cancel the item-on-cursor-action.

Exampel code

** SwITCH 2H and 1H+SHIELD **
/script if( not CursorHasItem() ) then
/script PickUpInventoryItem(17);
/script if( CursorHasItem() ) then
/script PickUpContainerItem(bag1, slot1); //Place shield in empty slot in left most bag, slot has to be empty
/script PickUpContainerItem(bag2, slot2); //Pick up 2h
/script PickUpInventoryItem(16); //Switch 1h to 2h
/script PickUpContainerItem(bag2, slot2); //Place 1h where 2h was
/script else
/script PickUpInventoryItem(16);
/script PickUpContainerItem(bag2, slot2); //Place 2h and grab 1h
/script PickUpInventoryItem(16); //Equip 1h
/script PickUpContainerItem(bag1, slot1); //Pick up shield
/script PickUpInventoryItem(17);
/script end
/script else
/script *This is where I run into problems. I want to either place the item anywhere in the inv, or right click to remove the item from the cursor.*
/script end

Munson
11-28-2004, 01:59 AM
bump. :)

sarf
11-28-2004, 12:08 PM
There is no "builtin" function for finding an unused slot, however!

SarfEquip (http://www.fukt.bth.se/~k/wow/scripts/SarfEquip/) has a function for doing this : FindFreeBagSlot().

You can either copy this function or just install the AddOn and use the function directly.

Note that you are likely to run into the 255 character macro limitation.

Sarf
---
My mind not only wanders, sometimes it leaves completely.

Munson
11-28-2004, 10:45 PM
Thanks Sarf.

Yes, I know about the 255 character limitation. I'm planning on making a function of it, but I dont have Wow yet, so I cant test anything and therefore I just wrote a macro.