Zmud - Saving a pattern into a variable.

... A place to ask for help on any topic whether it be starting out to player killing to IT issues.
Enok
Posts: 166
Joined: Sat Apr 16, 2016 3:44 pm
Location: Sweden

Zmud - Saving a pattern into a variable.

Post by Enok » Fri Oct 07, 2016 9:37 am

I've been trying to create a trigger for a while but keep getting lost...

Let's say I have the following scenario:

Code: Select all

R HP:Scratched MV:Full - Matmartigan: Critical >
What I want to do is to activate a trigger through an alias (alternatively using a trigger that's always active) where I save a part of a pattern into a variable that i can then activate with a separate alias.

Let's say I want to target Matmartigan with a weave later on. I would like to be able to, in the heat of the moment, hit an alias that saves Matmartigan, and only that name, into the variable.

In my old client, I used '%0' to indicate random pattern but I can't seem to get the brackets right for zmud.

Something like this:

Code: Select all

#alias lt {#var crittarget %0} <- Just so that I can manually change the name of the target.

#alias tt {#tri (- %0: Critical >)} {lt %0} <- This is obviously the part I'm having problems with. I want it to activate and run on keypress and then stop. I used to have an #IF clause in my old client that put out an echo depending on whether there was a target or not. 

- then later on followed by a normal target alias:

#alias isc {channel 'ice spikes' h.@crittarget}

Scizzor
Posts: 68
Joined: Mon May 04, 2015 2:20 am

Re: Zmud - Saving a pattern into a variable.

Post by Scizzor » Fri Oct 07, 2016 11:38 am

You'd do something like this for the alias.

Code: Select all

#alias {`} {@targetnow = @enemy}
That would just assign the variable enemy to targetnow, you'd have to have an alias to weave targetnow. So:

Code: Select all

#alias {ist} {channel 'ice spikes' h.@targetnow}
But, to get @enemy, you'd need something like:

Code: Select all

#trigger {^{o|*} * - (*): (*) >} {#VAR enemy "%1";#VAR health "%2";#VAR engaged 1}
That detects if you're actually fighting something, what their name is and what their health is. It's the 2 {*} that are the variables in that trigger. Everything else just is accepting wildcards for whatever your name is or light and dark. The enemy is the enemy obviously, health is health, and an extra variable always helps to put you in a "fighting mode" so "engaged 1". Then you can have other things happen if you're engaged or not.

You could just skip the very first trigger and have the last trigger put "enemy" into "targetnow" so you always have the last person you hit as the one you're going to weave, but that's not always the case, in case someone runs crit, and you get hit by a grass or something, then find em and try to weave em, and... you weave a grass.

If you want it to trigger specifically when someone is crit, like you sorta mentioned, you could just do an if statement inside the trigger. like:

Code: Select all

#trigger {^{o|*} * - (*): (*) >} {#VAR enemy "%1";#VAR health "%2";#VAR engaged 1;#IF {@health="Critial"} {@targetnow = @enemy}}
And then if you want to manually change it, you could make something like:

Code: Select all

#alias {kt} {#VAR targetnow {%1};#ECHO Target~[1~] SET TO: %1}
And you'd just type kt ArielWinter and it'd set that to your targetnow.

Anyways, hope that helps... and is clear at all!

Enok
Posts: 166
Joined: Sat Apr 16, 2016 3:44 pm
Location: Sweden

Re: Zmud - Saving a pattern into a variable.

Post by Enok » Fri Oct 07, 2016 3:44 pm

Thanks man!

I'll give this a try later on tonight.

Taziar
Posts: 952
Joined: Sat Mar 21, 2015 10:28 pm
Location: !Discord

Re: Zmud - Saving a pattern into a variable.

Post by Taziar » Fri Oct 07, 2016 5:03 pm

I have not tested this but, the trigger that Scizzor wrote might work better if you...

#trigger {^{o|*} * - (%w): (*) >}

The %w will only match a single word (in this case a name) so that way only character names should be captured because most all mobs have multi-word names.

Also you need to add {prompt|nocr} to the end of trigger for it to work off of the prompt. Something like...

#TRIGGER "" {^{o|*} * - (%w): (*) >} {whatever you want trigger to do} "" {prompt|nocr}

just as an informational...

#TRIGGER "trigger id" {pattern} {trigger action} "class" {trigger options}

Enok
Posts: 166
Joined: Sat Apr 16, 2016 3:44 pm
Location: Sweden

Re: Zmud - Saving a pattern into a variable.

Post by Enok » Fri Oct 07, 2016 7:31 pm

So here's where I am now and I'm still wondering if I have the syntax down. I think I'm over-complicating things or using the wrong pattern to load my variable:

#alias lt {#var currenttarget %w}

#alias gg {#trigger {^{o|*} * - (%w): (*) >} {lt %w} {prompt|nocr}}

#alias y {Kill @currenttarget}

Taziar
Posts: 952
Joined: Sat Mar 21, 2015 10:28 pm
Location: !Discord

Re: Zmud - Saving a pattern into a variable.

Post by Taziar » Fri Oct 07, 2016 7:44 pm

Couple of things...

%w is used for pattern matching only to dictate what you capture, in this case only a word, no numbers, spaces, or symbols. So this only goes inside the trigger pattern section. Enclose in (%w) to be able to access it via %1-%99.

First you are going to want to have all of this inside its own #CLASS

#CLASS {whatever you want name here}
<script goes between #CLASS {name} and #CLASS 0>
#CLASS 0

Don't put a #TRIGGER inside an #ALIAS unless you want to be creating a new trigger every time, triggers can stand on their own. Here the trigger is...

#TRIGGER "" {^{o|*} * - (%w): (*) >} {#VAR currentTarget %1} "" {prompt|nocr}

This will place the captured pattern inside the currentTarget variable whenever it is captured.

If you want to turn the trigger on and off add a trigger id...

#TRIGGER "nameCaptureTrigger" {^{o|*} * - (%w): (*) >} {#VAR currentTarget %1} "" {prompt|nocr}

You can turn it on and off with the #T+ and #T- commands...

#ALIAS gg {#T- nameCaptureTrigger}
#ALIAS ggg {#T+ nameCaptureTrigger}

Could also create one command that toggled it on and off, but that is more than I can explain at the moment.

This make sense?

Taziar
Posts: 952
Joined: Sat Mar 21, 2015 10:28 pm
Location: !Discord

Re: Zmud - Saving a pattern into a variable.

Post by Taziar » Mon Oct 10, 2016 10:06 am

Get this to work for you Enok?

Another thought: place %proper() around the %w like this %proper(%w) will make the pattern capture a little more accurate.

Actually I better test that first, not 100% sure it works like that.

Taziar

Taziar
Posts: 952
Joined: Sat Mar 21, 2015 10:28 pm
Location: !Discord

Re: Zmud - Saving a pattern into a variable.

Post by Taziar » Mon Oct 10, 2016 2:16 pm

Taziar wrote: Another thought: place %proper() around the %w like this %proper(%w) will make the pattern capture a little more accurate.
Taziar
Bah! Don't think that will work, can't call functions in triggers in zmud.

Taziar
Posts: 952
Joined: Sat Mar 21, 2015 10:28 pm
Location: !Discord

Re: Zmud - Saving a pattern into a variable.

Post by Taziar » Mon Oct 10, 2016 5:27 pm

This might work instead:

[A-Z]%w

Should force pattern matching to match a capitalized letter and then the rest of the name with %w.

I will confirm once I can get home and test it.

Taziar

Scizzor
Posts: 68
Joined: Mon May 04, 2015 2:20 am

Re: Zmud - Saving a pattern into a variable.

Post by Scizzor » Mon Oct 10, 2016 9:12 pm

I'm pretty sure that will capture both Upper and Lower case names using: [A-Z]%w

It's a bit longer i think, but you could do an if statement on the first letter of the name. Or something like that.

But i think just the %w should be enough. Anyways, love the help Taziar!

Post Reply