Pet ID find function - Given playername or player ID

A forum for you to dump all the macros you create, allowing users to use, modify, and comment on your work.

Moderator: MacroQuest Developers

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Pet ID find function - Given playername or player ID

Post by ml2517 » Sun Dec 28, 2003 6:48 pm

This function was requested.. so here goes.

Edit: Err after Falco's comment I simplified this a bit. LOL

Code: Select all

| Find a players pet providing the players ID or Name
|
| To Find a Pet ID by a Players ID   :  /call FindPCPetByID PlayerID#
|
| To Find a Pet ID by a Players Name :  /call FindPCPetByName PlayerName
|
| If the result is equal to 0 then there was no pet for that player found.
| If you get a non zero number returned then you can simply /target id $return or whatever to target the pet.
|

Sub Main
|Example: Checking for Player: Playername's pet with a radius of 5000 for the search limit.

/call FindPCPetByName PlayerName
/if n $return!=0 {
    /echo Pets ID is: $return
    /echo Pets Name is: $spawn($return,name)
} else {
    /echo Pet Not Found!
}
/return


Sub FindPCPetByID(PlayerID) 
/return $spawn(@PlayerID,pet)

Sub FindPCPetByName(PlayerName) 
/return $spawn($searchspawn("@PlayerName",pc),pet)
Last edited by ml2517 on Mon Dec 29, 2003 3:09 am, edited 2 times in total.

Falco72
a hill giant
a hill giant
Posts: 215
Joined: Fri Sep 26, 2003 3:24 am

Post by Falco72 » Mon Dec 29, 2003 2:18 am

To Find a Pet ID by a Players ID:

Code: Select all

/target id @PlayerId
/delay 3
/if n $target(pet)==0 {
   /echo No pet
} else {
   /varset PetId $target(pet)
}
To Find a Pet ID by a Players Name:

Code: Select all

/target pc @PlayerName
/delay 3
if n $target(pet)==0 {
   /echo No pet
} else {
   /varset PetId $target(pet)
}
This code is different from the above one, infact you need to TARGET the player to have the pet id. This is not always a good thing, f.e. when the target is on the other side of the zone. Nevertheless, you can find it usefull.

BTW, you can have the same result using $spawn() without having to target the player. At the moment I am in a hurry and cant post it, I will do it ASAP.

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Mon Dec 29, 2003 3:02 am

Thanks heh.. I simplified it a bit after you pointed that out.