target/spawn names...

Need help with a macro you are writing? Ask here!

Moderator: MacroQuest Developers

overnuker2323
orc pawn
orc pawn
Posts: 18
Joined: Sat Sep 25, 2004 2:06 am

target/spawn names...

Post by overnuker2323 » Sat Sep 25, 2004 2:11 am

Is there a way to get the macro to respond to a partial name?

Example...

I'm foraging.

/if (${Cursor.Name.Equal[Tuft of Dire Wolf Fur]}) /autoinv

obviously, that'll work... but what about partial names of mobs you want to track?

/if (${LastSpawn.Name.Equal[ancient]}) /beep

This won't find the Ancient cyclops, and I don't know what his NAME is... (An_Ancient_cyclops112) etc.

Is there a way to just search for a partial match in the string returned?

Also, is there a way to just return a bool on a target?

For example... If (anything) targetted, return TRUE



Thanks in advance for the help, folks!


-S

SlimFastForYou
a hill giant
a hill giant
Posts: 174
Joined: Sat Jan 24, 2004 1:38 am

Post by SlimFastForYou » Sat Sep 25, 2004 2:30 am

Code: Select all

/if (${NearestSpawn[npc ancient].ID})  {
    /call RunToMob
    /call BeatSomeAss
    /call SomeOtherMadeUpRoutine
    /call LootAndCampOut
    /endmacro
}
If there are no NPCs with the word Ancient in their name, the ID will be 0, making the if statement evaluate to be false. If the ID is valid that meant there is an NPC with Ancient in it's name.


For further reference, look up /target in the readme. Those arguments are shared with similar functions in Macroquest, such as NearestSpawn, /mapfilter custom, etc.

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

Post by Falco72 » Sat Sep 25, 2004 2:33 am

From readme.chm:
STRING
Members

int Find[text]
Looks for the given text, gives position (currently NULL if not found)

So, in your example, you can use:

Code: Select all

/if (${LastSpawn.Name.Find[ancient]}) /beep 

overnuker2323
orc pawn
orc pawn
Posts: 18
Joined: Sat Sep 25, 2004 2:06 am

awesome

Post by overnuker2323 » Sat Sep 25, 2004 2:35 am

That exactly answered my question... thanks for the quick response like that!

I'm *very* new to writing macros, and haven't figured out the /call and event stuff, but I can write /if/else commands till the sun comes up :)


Thanks!

-S