Thread Tools Display Modes
12-22-14, 08:13 AM   #1
MrBerlin
A Murloc Raider
Join Date: Dec 2014
Posts: 4
Unhappy Pet Species id

hi,
everytime i try to get the speciesId via GetPetSpeciesID i get nil...
tried at several times in battle (openingstart, opening done, round results, ...) everytime i get nil. Rest of the Addon is working fine.

I tried every pet
Lua Code:
  1. speciesId = C_PetBattles.GetPetSpeciesID(ownerNumber, petIndex);
whatever i do, always speciesId is nil...
when i use it in a macro it always works fine

any suggestions? Is GetPetSpeciesID protected or something else?

thanks
Kai

UPDATE:

i tried
Lua Code:
  1. local a= {C_PetBattles.GetPetSpeciesID(trainerNumber, battleIndex)};
  2.     self.speciesId = C_PetBattles.GetPetSpeciesID(trainerNumber, battleIndex);
  3.     print("#a: "..#a.." | trainerNumber: "..trainerNumber.." | index: "..battleIndex.. " | Species ID: "..tostring(self.speciesId).." "..a[1]);
and it gave me
#a: 1 | trainerNumber: 1 | index: 1 | Species ID: nil 1601

anyone knows why it works when i put it in brackets?

Last edited by MrBerlin : 12-22-14 at 08:53 AM. Reason: Solved
  Reply With Quote
12-22-14, 09:05 AM   #2
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
If this is your exact code, then self.speciesId should be the same value as a[1], I suspect you may have just made a typo in the variable name which resulted in nil if this isn't your actual code.

Otherwise, something outside of what you posted here is affecting the value.
  Reply With Quote
12-22-14, 12:47 PM   #3
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
The question is, where are ownerNumber and trainerNumber from?

Blizzards code is calling it like this
Lua Code:
  1. local activePet = C_PetBattles.GetActivePet(LE_BATTLE_PET_ALLY|LE_BATTLE_PET_ENEMY);
  2. local speciesID = C_PetBattles.GetPetSpeciesID(LE_BATTLE_PET_ALLY|LE_BATTLE_PET_ENEMY, activePet);
  Reply With Quote
12-22-14, 05:17 PM   #4
MrBerlin
A Murloc Raider
Join Date: Dec 2014
Posts: 4
typo... used "speciesID" in print but the varname was "speciesId"...
sorry.

qac
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Pet Species id


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off