Yep you're right. The pet variables help says name is the true name (species name), but the script filter is actually using the custom name if one is defined. My first instinct is to fix this, but since it's been this way for years and some scripts perhaps depend on this behavior, and more importantly the more robust and more recent petInfo variable can get the species name, I'll probably fix the help text rather than change the behavior for "name".
To get a species name, use petInfo.speciesName like:
Code: Select all
return petInfo.speciesName:match("Tabby")
There's a lot more you can get from petInfo too. Each of the following (with a petInfo. before it) can grab this info about a pet:
petID: this is the pet reference Fetched (string, number, link, etc)
idType: "pet" "species" "leveling" "ignored" "link" "battle" "random" or "unknown" (string)
speciesID: numeric speciesID of the pet (integer)
customName: user-renamed pet name (string)
speciesName: name of the species (string)
name: customName if defined, speciesName otherwise (string)
level: whole level 1-25 (integer)
xp: amount of xp in current level (integer)
maxXp: total xp to reach next level (integer)
fullLevel: level+xp/maxXp (float)
displayID: id of the pet's skin (integer)
isFavorite: whether pet is favorited (bool)
icon: fileID of pet's icon or specific filename (integer or string)
petType: numeric type of pet 1-10 (integer)
creatureID: npcID of summoned pet (integer)
sourceText: formatted text about where pet is from (string)
loreText: "back of the card" lore (string)
isWild: whether the pet is found in the wild (bool)
canBattle: whether pet can battle (bool)
isTradable: whether pet can be caged (bool)
isUnique: whether only one of pet can be learned (bool)
isObtainable: whether this pet is in the journal (bool)
health: current health of the pet (integer)
maxHealth: maximum health of the pet (integer)
power: power stat of the pet (integer)
speed: speed stat of the pet (integer)
rarity: rarity 1-4 of pet (integer)
isDead: whether the pet is dead (bool)
isInjured: whether the pet has less than max health (bool)
isSummonable: whether the pet can be summoned (bool)
isRevoked: whether the pet is revoked (bool)
abilityList: table of pet's abilities (table)
levelList: table of pet's ability levels (table)
valid: whether the petID is valid and petID is not missing (bool)
owned: whether the petID is a valid pet owned by the player (bool)
count: number of pet the player owns (integer)
maxCount: maximum number of this pet the player can own (integer)
hasBreed: whether pet can battle and there's a breed source (bool)
breedID: 3-12 for known breeds, 0 for unknown breed, nil for n/a (integer)
breedName: text version of breed like P/P or S/B (string)
possibleBreedIDs: list of breedIDs possible for the pet's species (table)
possibleBreedNames: list of breedNames possible for the pet's species (table)
numPossibleBreeds: number of known breeds for the pet (integer)
needsFanfare: whether a pet is wrapped (bool)
battleOwner: whether ally(1) or enemy(2) pet in battle (integer)
battleIndex: 1-3 index of pet in battle (integer)
isSlotted: whether pet is slotted (bool)
inTeams: whether pet is in any teams (pet and species idTypes only) (bool)
numTeams: number of teams the pet belongs to (pet and species only) (integer)
sourceID: the source index (1=Drop, 2=Quest, 3=Vendor, etc) of the pet (integer)
moveset: the exact moveset of the pet ("123,456,etc") (string)
speciesAt25: whether the pet has a version at level 25 (bool)
hasNotes: whether the pet has notes
notes: the text of the pet's notes
isLeveling: whether the pet is in the queue
isSummoned: whether the pet is currently summoned (companion pet)
As new information is exposed about pets they get added to petInfo and the comments at the top of PetInfo.lua. Rematch uses this sytem extensively to efficiently gather information about pets through the disparate API so some stuff may not really apply to filters, like battleOwner, battleIndex, etc.
For instance if you want to make a filter for tier pets, you can add a note #tier1, #tier2, #tier3, to those pets and then
Code: Select all
return petInfo.hasNotes and petInfo.notes:match("#tier")
edit: If you'd like to experiment with petInfo outside of the scripting environment, there's a general purpose one globally defined called Rematch.petInfo, use Rematch.petInfo:Fetch(speciesID or petID) to start getting information about the pet:
Code: Select all
/run Rematch.petInfo:Fetch(42) -- fetched information about speciesID 42 (Black Tabby Cat)
/dump Rematch.petInfo.moveset
/dump Rematch.petInfo.numPossibleBreeds
Some information only applies to a specific pet (level, rarity, inTeams, etc), like:
Code: Select all
/run Rematch.petInfo:Fetch("BattlePet-0-0000029FB3C2") -- use a petID to fetch a specific pet
/dump Rematch.petInfo.level
/dump Rematch.petInfo.numTeams
And if curious, information is only pulled from the game API when requested, and results are cached when the API is eventually hit for that pet; and information that depends on querying all pets/teams (like numTeams) use temporary tables so a few hundred queries against the same data should be fast.