Targetting Trigger

by Tavon

Back to Mechanic's Corner.

Tavon2005-01-06 15:11:46
#TRIGGER {^"@gtar(%d)"} {tar %1}

Now, this doesn't work (in zMud 3.62a. I don't know whether it's a quirk of the program, or me. It works perfectly if I do something like ^"(%w)(%d)" and then check for gtar in the trigger, but that triggers on every line in info here. There's gotta be an easier way.
Vesar2005-01-06 15:23:14
I just do it manually. For instance, I type "t 2456" and it assigns 2456 to my targetting variable. You only need the number to target, but you can do either the number, name, or both. Play around with it a bit, you might find this to be an easier way. I personlly don't like auto-targetters because I like to have a little control on what I actually hit.
Tavon2005-01-06 15:27:05
I have it both ways. If I want to say what I hit, I type "tar xxxxx", if I'm going bashing, I just set up my generic target (for example, spectre), and then target the last spectre to enter the room when I do info here, and smash its face in. Simple, no?

Regardless, I know how to do it manually. Thanks anyway.
Vesar2005-01-06 16:22:04
Ah, I see what you mean. I was confused, sorry. Hope you get it figured out, though. I'd be interested to see the solution. My first quess would be a script with captures all of INFO HERE and actually chooses the last creature of the type in @gtar.

Unknown2005-01-06 16:38:46
Try using curly braces around your variable name (not including the @ symbol), and if that doesn't work, change your preferences (under Settings, Preferences, Script Parser) to expand variables/expressions inside curly braces and then put braces around the entire variable (including the @ this time). I find that the braces make my variables expand nicely in my trigger patterns with this setting enabled.
Tavon2005-01-06 17:44:34
#TRIGGER {^?({@gtar}%d)"} {tar %1} "Targetting"

That works. Not sure why I have to have a wildcard (?) instead of a leading ", but it works this way and not the other. Thanks Zarquan.
Unknown2005-01-07 01:43:19
? matches any single character, in this case a ". The problem from before you did this was that the "" would be stripped in the pattern, as in that one, it does not match to the last ", which is removed, so your trigger would match something like "rat12345jingle bells. To make it match the second (or both) quotations, do this:
CODE
#TRIGGER {^~"({@gtar}%d)~"} {tar %1} "Targetting"

You probably don't need those curly brackets, though, as, from you earlier script, @gtar(%d) might make it think @gtar is a function variable. So, with the brackets now around the entire thing ((@gtar%d)), it wont think it is a function.