Page 1 of 1

target/spawn names...

Posted: Sat Sep 25, 2004 2:11 am
by overnuker2323
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

Posted: Sat Sep 25, 2004 2:30 am
by SlimFastForYou

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.

Posted: Sat Sep 25, 2004 2:33 am
by Falco72
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 

awesome

Posted: Sat Sep 25, 2004 2:35 am
by overnuker2323
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