On verifying resulting target from a /assist...

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

OldNecro
a ghoul
a ghoul
Posts: 136
Joined: Thu Dec 19, 2002 3:09 am

On verifying resulting target from a /assist...

Post by OldNecro » Sat Feb 28, 2004 10:31 am

If I /assist my main tank, I can verify that he has targeted an NPC by using $target(type). What if he has someone's pet targeted? Will it return NPC, or is pet a specific type? The documentation says $target(type) can only return PLAYER or NPC...
Saddam Hussein begins to use An Innocent Bystander as a living shield!
An Innocent Bystander ceases protecting Saddam Hussein's corpse.

Gumby
a ghoul
a ghoul
Posts: 99
Joined: Sat Jan 24, 2004 5:27 pm

Re: On verifying resulting target from a /assist...

Post by Gumby » Sat Feb 28, 2004 11:36 am

OldNecro wrote:If I /assist my main tank, I can verify that he has targeted an NPC by using $target(type). What if he has someone's pet targeted? Will it return NPC, or is pet a specific type? The documentation says $target(type) can only return PLAYER or NPC...
Returns NPC, hence seperate check:

Code: Select all

/if n $target(master)!=0 {
   //then target is a pet
}
My check for determing whether the pet is actually an NPC's pet or a PC's didn't work too well and I've never bothered tweaking it but to give you an attempt of what I was trying:

Code: Select all

/if "$spawn($target(master),type)"=="player"
If you figure out something workable for it, let me know por favor :).

G

OldNecro
a ghoul
a ghoul
Posts: 136
Joined: Thu Dec 19, 2002 3:09 am

Post by OldNecro » Sun Feb 29, 2004 9:06 am

you almost had it...

$target(master) returns a name, not an ID. $spawn() requires an id.

so, this should work:

/if $spawn($id($target(master)),type)=="PLAYER"

Also, different people use lots of different syntax regarding quotes an whatnot... I don't use them unless i'm passing a hard string rather than a variable or function returning a string and that seems to work.
Saddam Hussein begins to use An Innocent Bystander as a living shield!
An Innocent Bystander ceases protecting Saddam Hussein's corpse.

Gumby
a ghoul
a ghoul
Posts: 99
Joined: Sat Jan 24, 2004 5:27 pm

Post by Gumby » Sun Feb 29, 2004 3:19 pm

OldNecro wrote:$target(master) returns a name, not an ID. $spawn() requires an id.
$target(master) returns the ID for me when I first wrote it, and still does when I just checked it against a BST warder :).

As for the quotes, I simply quote every string variable, even if one doesn't need it for any string which doesn't include spaces.

I've a tendency to reuse code, once got bitten when switching to a multi-word string so now /shrug.

G

OldNecro
a ghoul
a ghoul
Posts: 136
Joined: Thu Dec 19, 2002 3:09 am

Post by OldNecro » Sun Feb 29, 2004 3:25 pm

Yup, sure enough I read it wrong... It does return the id. Hmm, in that case, I don't know why your code wouldn't work, G....
Saddam Hussein begins to use An Innocent Bystander as a living shield!
An Innocent Bystander ceases protecting Saddam Hussein's corpse.