WoW API: PickupSpell

Revision as of 20:01, 11 November 2008 by WoWWiki>Toadkiller
PickupSpell("spellName" | spellId, bookType)

Puts a spell with spellId on mouse cursor.


Arguments
spellName
String - the name of the spell.
spellId
Numeric - the offset (position) of spell in spellbook. SpellId can change when you learn new spells.
bookType
String - Either BOOKTYPE_SPELL ("spell") or BOOKTYPE_PET ("pet").

Returns
Nothing.

Details
This function will put a spell on mouse cursor. The spell is defined by spellbook and it's position in the spellbook.
The cursor needs to be clear in order to use this function.

Example

This example shows, how to put the most powerful version of a spell on cursor.

 PickupSpell(spellName)

or

 function findSpell(spellName, bookType)
   local i, s;
   local found = false;
   for i = 1, MAX_SKILLLINE_TABS do
     local name, texture, offset, numSpells = GetSpellTabInfo(i);
     if (not name) then break; end
     for s = offset + 1, offset + numSpells do
       local	spell, rank = GetSpellName(s, bookType);
       if (spell == spellName) then found = true; end
       if (found and spell ~=spellName) then return s-1; end
     end
   end
   if (found) then return s; end
   return nil;
 end
 local bookType = BOOKTYPE_SPELL;
 local id = findSpell(spellName, bookType);
 PickupSpell(id, bookType);

see also PickupAction(), PickupPetAction(), PickupBagFromSlot(), PickupContainerItem(), PickupInventoryItem(), PickupItem(), PickupMacro(), PickupMerchantItem(), PickupPetAction(), PickupPlayerMoney(), PickupStablePet(), PickupTradeMoney(), ClearCursor()


WoW API < PickupSpell