Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Strakc
Apprentice


Joined: 31 Jan 2006
Posts: 106
Location: Virginia Beach, Virginia

PostPosted: Wed Jun 28, 2006 5:40 am   

Trigger help
 
trying to get each portion of this prompt sent to a variable

{150/150} HP {100/100} Chakra {400/400} Stamina {192548/312852(38%)} TNL (45) Ryo {K} Style 0

the 0 after style is alignment, so I tried something I remember from way back when... using &(variablename) but that wouldn't match at all
Reply with quote
mr_kent
Enchanter


Joined: 10 Oct 2000
Posts: 698

PostPosted: Wed Jun 28, 2006 6:33 am   Re: Trigger help
 
Code:
{150/150} HP {100/100} Chakra {400/400} Stamina {192548/312852(38%)} TNL (45) Ryo {K} Style 0

First quote any Special Characters (#;@%:./!~>and & by default) and characters used for parsing ({[()]}) using the quote character (~ by default):
Code:
~{150~/150~} HP ~{100~/100~} Chakra ~{400~/400~} Stamina ~{192548~/312852~(38~%~)~} TNL ~(45~) Ryo ~{K~} Style 0

Then, using the Pattern Matching wildcards listed in help|references, replace the variable values:
Code:
~{&%dunknown~/&%dmaxunknown~} HP ~{&%dHP~/&%dMHP~} Chakra ~{&%dChakra~/&%dmaxChakra~} Stamina ~{&%dStam~/&%dmaxStam~(&%dStamPercent~%~)~} TNL ~(&%dTNL~) Ryo ~{&[KLMNO]Ryo~} Style &%dAlign


Or, if you opt to not use the &VarName syntax:
Code:
~{%d~/%d~} HP ~{%d~/%d~} Chakra ~{%d~/%d~} Stamina ~{%d~/%d~(%d~%~)~} TNL ~(%d~) Ryo ~{[KLMNO]~} Style %d

And finally, put parenthesis around the parts you'd like to capture to variables. You wanted each portion so:
Code:
~{(%d)~/(%d)~} HP ~{(%d)~/(%d)~} Chakra ~{(%d)~/(%d)~} Stamina ~{(%d)~/(%d)~((%d)~%~)~} TNL ~((%d)~) Ryo ~{([KLMNO])~} Style (%d)

Finally, to assign each portion to a variable,
Code:
#TRIGGER PromptCapture {^~{(%d)~/(%d)~} HP ~{(%d)~/(%d)~} Chakra ~{(%d)~/(%d)~} Stamina ~{(%d)~/(%d)~((%d)~%~)~} TNL ~((%d)~) Ryo ~{([KLMNO])~} Style (%d)} {#VAR unknown %1;#VAR maxunknown %2;#VAR HP %3;#VAR MHP %4;#VAR Chakra %5;#VAR maxChakra %6;#VAR Stamina %7;#VAR maxStamina %8;#VAR StamPercent %9;#VAR TNL %10;#VAR Ryo %11;#VAR Style %12} "" {prompt}

If you're not needing the Ryo value of K to be captured, you can use #SETPROMPT:
Code:
#SETPROMPT "{" unknown maxunknown HP maxHP Chakra maxChakra Stamina maxStamina StamPercent TNL Style


Hope that helps. Smile
Reply with quote
Strakc
Apprentice


Joined: 31 Jan 2006
Posts: 106
Location: Virginia Beach, Virginia

PostPosted: Wed Jun 28, 2006 6:49 am   
 
it does kinda like ~{&%dunknown~/&%dmaxunknown~} HP ~{&%dHP~/&%dMHP~} Chakra ~{&%dChakra~/&%dmaxChakra~} Stamina ~{&%dStam~/&%dmaxStam~(&%dStamPercent~%~)~} TNL ~(&%dTNL~) Ryo ~{&[KLMNO]Ryo~} Style &%dAlign I'll try something like this again. But also just so you know all the values have the name AFTER the {} so ryo is the 45 and style is the k =P
Reply with quote
Strakc
Apprentice


Joined: 31 Jan 2006
Posts: 106
Location: Virginia Beach, Virginia

PostPosted: Wed Jun 28, 2006 6:53 am   
 
~{&%dhealth~/&%dmaxhealth~} HP ~{&%dchakra~/&%dmaxchakra~} Chakra ~{&%dstamina~/&%dmaxstamina~} Stamina ~{&%dexp~/&%dtnl~(&%dtnlper~%~)~} TNL ~(&%dryo~) Ryo ~{&%dstyle~} Style &%dalign I tried this, but this doesn't catch so
Reply with quote
mr_kent
Enchanter


Joined: 10 Oct 2000
Posts: 698

PostPosted: Wed Jun 28, 2006 8:17 am   
 
Okay, does this fire?
Code:
#TRIGGER PromptCapture {^~{%d~/%d~} HP ~{%d~/%d~} Chakra ~{%d~/%d~} Stamina ~{%d~/%d~(%d~%~)~} TNL ~(%d~) Ryo ~{?~} Style %d} {#SHOW So far so good!} "" {prompt}


Edit: pasted the wrong line.
Reply with quote
mr_kent
Enchanter


Joined: 10 Oct 2000
Posts: 698

PostPosted: Wed Jun 28, 2006 8:27 am   
 
Strakc wrote:
~{&%dhealth~/&%dmaxhealth~} HP ~{&%dchakra~/&%dmaxchakra~} Chakra ~{&%dstamina~/&%dmaxstamina~} Stamina ~{&%dexp~/&%dtnl~(&%dtnlper~%~)~} TNL ~(&%dryo~) Ryo ~{&%dstyle~} Style &%dalign I tried this, but this doesn't catch so


That won't fire because %d doesn't catch alpha characters.

~{&%dhealth~/&%dmaxhealth~} HP ~{&%dchakra~/&%dmaxchakra~} Chakra ~{&%dstamina~/&%dmaxstamina~} Stamina ~{&%dexp~/&%dtnl~(&%dtnlper~%~)~} TNL ~(&%dryo~) Ryo ~{&%dstyle~} Style &%dalign

Should be:

~{&%dhealth~/&%dmaxhealth~} HP ~{&%dchakra~/&%dmaxchakra~} Chakra ~{&%dstamina~/&%dmaxstamina~} Stamina ~{&%dexp~/&%dtnl~(&%dtnlper~%~)~} TNL ~(&%dryo~) Ryo ~{&%wstyle~} Style &%dalign
Reply with quote
Strakc
Apprentice


Joined: 31 Jan 2006
Posts: 106
Location: Virginia Beach, Virginia

PostPosted: Wed Jun 28, 2006 4:22 pm   Re: Trigger help
 
Code:
#TRIGGER PromptCapture {^~{(%d)~/(%d)~} HP ~{(%d)~/(%d)~} Chakra ~{(%d)~/(%d)~} Stamina ~{(%d)~/(%d)~((%d)~%~)~} TNL ~((%d)~) Ryo ~{([KLMNO])~} Style (%d)} {#VAR unknown %1;#VAR maxunknown %2;#VAR HP %3;#VAR MHP %4;#VAR Chakra %5;#VAR maxChakra %6;#VAR Stamina %7;#VAR maxStamina %8;#VAR StamPercent %9;#VAR TNL %10;#VAR Ryo %11;#VAR Style %12} "" {prompt}

this right here worked, expect the fact that the unknowns are the hp style is the k portion and the 0 is align
Reply with quote
mr_kent
Enchanter


Joined: 10 Oct 2000
Posts: 698

PostPosted: Wed Jun 28, 2006 5:39 pm   Re: Trigger help
 
Code:
#TRIGGER PromptCapture {^~{(%d)~/(%d)~} HP ~{(%d)~/(%d)~} Chakra ~{(%d)~/(%d)~} Stamina ~{(%d)~/(%d)~((%d)~%~)~} TNL ~((%d)~) Ryo ~{([KLMNO])~} Style (%d)} {#VAR health %1;#VAR maxhealth %2;#VAR chakra %3;#VAR maxchakra %4;#VAR stamina %5;#VAR maxstamina %6;#VAR exp %7;#VAR tnl %8;#VAR tnlper %9;#VAR ryo %10;#VAR style %11;#VAR align %12} "" {prompt}


That fixes the variable names.

The only part that will need tweaked is your style capture. As this is written, it will capture any one letter or any combination of letters in the group [KLMNO]. I have no idea what possible value(s) are possible for style, but you should be able to change this as needed.
Reply with quote
Strakc
Apprentice


Joined: 31 Jan 2006
Posts: 106
Location: Virginia Beach, Virginia

PostPosted: Wed Jun 28, 2006 11:47 pm   
 
Code:
                          Score Information For:
                                Kotetsu
----------------------------------------------------------------------------


I am trying to catch the name, now some of the names can have to, and its a japanese like theme... so lastname will come first and I really dont care about the last name... but I am thinking either way its going to be a pain to get the first name
Reply with quote
Strakc
Apprentice


Joined: 31 Jan 2006
Posts: 106
Location: Virginia Beach, Virginia

PostPosted: Thu Jun 29, 2006 12:56 am   
 
Code:
STR  : 20(20)                              Saved:   Wed Jun 28 19:36:11 2006
INT  : 05(05)                              Created:   Sun Jun 25 11:26:40 2006
WIS  : 05(05)      Armor: Capable of Resisting a Strong Breeze
DEX  : 05(05)      Align:    0; Neutral        Items:  4 (max 5)
CON  : 05(05)      Pos'n: Standing             Weight: 16 (max 500)
CHA  : 05(05)                                  Bank: 0¥
LCK  : 12(10)      Style: Kame                 Bloodtype: B


While i'm at it heh I'm wanting to make a trigger to catch the name of the stat and its currect.. cur(base) and I was wanting to use just a single trigger for this but I dont know how it might work heh
Reply with quote
Strakc
Apprentice


Joined: 31 Jan 2006
Posts: 106
Location: Virginia Beach, Virginia

PostPosted: Fri Jun 30, 2006 10:12 pm   
 
Aww no more help for me?
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Fri Jun 30, 2006 10:36 pm   
 
Here is a line example:

DEX : 05(05) Align: 0; Neutral Items: 4 (max 5)
#TRIGGER{^DEX%s:%s(%d)~((%d)~)%sAlignn:%s(%d)~;%s(*)%sItems~:%s(%d)%s~(max%s(%d)~)} {#VAR Dex %1;#VAR Dex2 %2;#VAR Align %3;#VAR ItemCount %4;#VAR ItemCountMax %5}

See help patterns I believe.
Reply with quote
Strakc
Apprentice


Joined: 31 Jan 2006
Posts: 106
Location: Virginia Beach, Virginia

PostPosted: Fri Jun 30, 2006 10:56 pm   
 
Right, but I want to know if I can create a single trigger to catch all the stat types. Not just one for every stat
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sat Jul 01, 2006 2:57 am   
 
Use a stringlist pattern:

#trigger {({DEX|other stats})%s:%s(%d)~((%d)~)} {stuff to do here}
_________________
EDIT: I didn't like my old signature
Reply with quote
Strakc
Apprentice


Joined: 31 Jan 2006
Posts: 106
Location: Virginia Beach, Virginia

PostPosted: Sat Jul 01, 2006 8:53 am   
 
Strakc wrote:
Code:
                          Score Information For:
                                Kotetsu
----------------------------------------------------------------------------



anyone have an idea how i could catch the name? its a japanese style mud and I could have a last name, so it could be like Ryu Kotetsu. And I only want to catch kotetsu
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sat Jul 01, 2006 10:20 pm   
 
Use a three-state trigger:

1)Score Information For:
2)(*)
3)-----------------------------------------------------

#2 is where your processing will be:

#if (%numwords(%trim("%1")," ") = 2) {#noop is a lastname/firstname setup;CharacterName = %word(%trim("%1"),2," ")} {#noop one word only;CharacterName = %trim("%1")}

The " " in the word functions are purely optional as these command default to spaces, I only included them for clarity.
_________________
EDIT: I didn't like my old signature
Reply with quote
Strakc
Apprentice


Joined: 31 Jan 2006
Posts: 106
Location: Virginia Beach, Virginia

PostPosted: Sat Jul 01, 2006 10:45 pm   
 
uhh... whats... a three-state trigger? heh
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sat Jul 01, 2006 11:22 pm   
 
A multistate trigger, with 3 states. Codewise, it'd be one #TRIGGER followed by two #CONDITIONs
_________________
EDIT: I didn't like my old signature
Reply with quote
Strakc
Apprentice


Joined: 31 Jan 2006
Posts: 106
Location: Virginia Beach, Virginia

PostPosted: Sun Jul 02, 2006 12:27 am   
 
uhh could you show me an example? I never understood #CONDITION...
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Jul 02, 2006 2:44 am   
 
As it pertains to multistate triggers, only these commands can be used for state 0 (#ALARM cannot be used in multistate triggers, and I'm not sure about #TEMP.) State 0 triggers are standalone triggers.

#TRIGGER/#ONINPUT/#MXPTRIG/#REGEX/#ACTION

#CONDITION is a synonym for #TRIGGER, with the sole exception being that it cannot stand alone. It has to be immediately following a state-0 trigger command as shown above.

For example:

Correct
#TRIGGER {blah} {blah}
#CONDITION {blah} {blah}

Incorrect
#TRIGGER {blah} {blah}
#ALIAS Bad {stuff}
#CONDITION {blah} {blah}

#CONDITION and #TRIGGER have some options to it, which are explained in detail in the help files, that allow you to specify what type of trigger. There are so many of them that it's better to look at them there than here in the posts.
_________________
EDIT: I didn't like my old signature
Reply with quote
Strakc
Apprentice


Joined: 31 Jan 2006
Posts: 106
Location: Virginia Beach, Virginia

PostPosted: Sun Jul 02, 2006 8:16 am   
 
so it would be like this?

Code:
#trigger {Score information for:}
#condition {(*)} {#if (%numwords(%trim("%1")," ") = 2) {#noop is a lastname/firstname setup;CharacterName = %word(%trim("%1"),2," ")} {#noop one word only;CharacterName = %trim("%1")} }
#condition {-----------------------------------------------------}
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Jul 02, 2006 7:05 pm   
 
Yep. Well, other than the missing {} at the end of #CONDITION number 2. Every trigger must have two sets of curly braces, even if the trigger doesn't do anything code-wise.
_________________
EDIT: I didn't like my old signature
Reply with quote
CaelinMoonflair
Newbie


Joined: 23 Jun 2006
Posts: 4

PostPosted: Mon Jul 03, 2006 1:42 am   
 
I don't know how to do it without using regex, but here's a way to do it with.

You could have a trigger responding to

Score Information For:

enable your next trigger.

Then you have a regex trigger with a pattern:

\w* (\w+)

This would find just the last name and put it in %1 and you can disable the trigger again.
Reply with quote
Strakc
Apprentice


Joined: 31 Jan 2006
Posts: 106
Location: Virginia Beach, Virginia

PostPosted: Mon Jul 03, 2006 3:04 pm   
 
Matts suggestion worked just fine. I only have have a question though. Because when the trigger catchs the first and second line is the thrid even needed to match?
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Tue Jul 04, 2006 12:20 pm   
 
The third is often to do any final steps, clear up, things like that or as a stop point. If things are working with only the first two then drop the third.
_________________
Taz :)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net