API CallCompanion

From Wowpedia
Jump to: navigation, search

Summons the specified companion.

CallCompanion("type", id)

Arguments

type 
String - The type of companion to summon or dismiss: "CRITTER" or "MOUNT".
id 
Number - The companion index to summon or dismiss, ascending from 1.

Example

The following macro summons the [alphabetically] first mount your character has acquired:

/run CallCompanion("MOUNT",1)

The following macro summons a random mount your character has acquired:

/run CallCompanion("MOUNT", random(GetNumCompanions("MOUNT")))

Notes

  • The list of companions is usually, but not always, alphabetically sorted. You may not rely on the indices to remain stable, even if the number of companions is not altered.

Patch history

Mists of Pandaria Patch 5.0.4 (2012-08-28): Companions are now account-wide. This function only works for non-combat companions (battle pets) your character had acquired before the account-wide merge, as well as all mounts. For summoning battle pets, use the C_PetJournal API.
Wrath of the Lich King Patch 3.0.2 (2008-10-14): Added.

See also