search for partial spawn name

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

search for partial spawn name

Post by OldNecro » Fri Feb 27, 2004 10:14 pm

I want to pass a partial spawn name and obtain the id of the first thing in the zone whose name contains the substring...

/macro crap.mac deser ("deser" being param0)

/echo $id(a desert tarrantula) <--(the id of the first one it finds)

please tell me I don't have to parse every spawn name in the zone... /cry
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 » Sat Feb 28, 2004 8:04 am

First thing as in nearest I assume?

/target and $searchspawn work on a radially outward fashion anyway (by default from your loc), $searchspawn(npc,deser) will return the ID of the closest mob with "deser" in it's name.

Works simililarly for /tar npc deser if you want to actually target it immediately.

G

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

Post by OldNecro » Sat Feb 28, 2004 9:17 am

Hmmm... After RTFM, it says the syntax is $searchspawn("npcname",npc) which would lead me to believe it won't accept substrings, but I'm gonna mess with it and see what happens. Thanks for narrowing it down to the command I need to look at.
Saddam Hussein begins to use An Innocent Bystander as a living shield!
An Innocent Bystander ceases protecting Saddam Hussein's corpse.