1. The default UI already has a "/summonpet White Kitten" command to summon a specific companion pet.
2. However, if you really want to use an addon that prevents you from summoning the pet if you already have another one summoned or if you're not moving (why???) here you go. Use the "/favpet" command to summon the pet. You can optionally specify a different pet name, eg. "/favpet Leaping Hatchling".
Code:
-- Change this to the exact name of the pet you want to summon:
local DEFAULT_PET = "White Kitten"
-- Nothing below here needs to be changed.
SLASH_CALLFAVORITEPET1 = "/favpet"
SlashCmdList.CALLFAVORITEPET = function(petName)
if InCombatLockdown() then
-- You can't summon a pet in combat from insecure code.
return
end
if GetUnitSpeed("player") == 0 then
-- You aren't moving.
return
end
if C_PetJournal.GetSummonedPetGUID() then
-- You already have a summoned pet.
return
end
if petName and strlen(petName) == 0 then
-- Summon the default pet specified above if no other pet name
-- was provided with the command:
petName = DEFAULT_PET
end
local _, petGUID = C_PetJournal.FindPetIDByName(petName)
if petGUID then
-- Summon the desired pet:
C_PetJournal.SummonPetByGUID(petGUID)
else
-- Pet not found. Alert the user so they can fix it:
print(format("Pet %q not found!", petName))
end
end
If you need help turning the above code into an addon, copy and paste it into this page:
http://addon.ziuo.net/
If that's not what you want, please describe what you want more clearly. If it doesn't work correctly, please describe what doesn't work and provide any error messages captured by BugSack.