|
Anthalas Newbie
Joined: 17 Dec 2009 Posts: 7
|
Posted: Thu Dec 17, 2009 5:35 pm
Triggers |
Hi there,
Up until recently I've been sharing a computer with a friend and playing muds on Zmud. To make the long story short and get to the gist of my problem, I am now using CMUD.
Back when I was using Zmud, I had triggers that I would use to remind me of the names of characters I had met (my mud is an rpi and uses descs)
The trigger goes like this #TRIGGER {A pale-skinned young man} {#sub (Tego);#CW Violet} "" {verbatim}
and what it would do was change the string: A pale-skinned young man to (Tego) A pale-skinned young man, adding the name to the start of the string but nothing else.
When I tried this in CMUD however, it would output the following instead.
(Tego)
#CW Violet
Is there a new syntax or variable that I should be using? |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu Dec 17, 2009 5:51 pm |
Actually, that would have been a bad script in zMUD too. The () around the argument is the wrong syntax, which zMUD didn't complain about, but CMUD doesn't like. The #SUB command always replaces the matching text with the value given to #SUB. So CMUD is actually doing what zMUD was supposed to be doing to...it is replacing your matching pattern string with (Tego). The fact that zMUD didn't replace the entire pattern with #SUB was a bug in zMUD.
The correct way to do this in CMUD is:
#TRIGGER {(A pale-skinned young man)} {#sub {(Tego) %1};#CW Violet} "" {verbatim}
Basically, putting () around the entire trigger pattern will load the matching result into %1, and the #SUB command will put (Tego) in front of the %1 matching text. The {} are used with #SUB to surround the argument properly. |
|
|
|
Anthalas Newbie
Joined: 17 Dec 2009 Posts: 7
|
Posted: Thu Dec 17, 2009 6:05 pm |
It was a bug I loved
Thanks very much Zugg. I like CMud a lot better than Zmud so I think I will be making the purchase soon.
Edit: That doesn't work either :(
#TRIGGER {(A pale-skinned young man)} {#sub {(Tego) %1};#CW Violet} "" {verbatim} does not fire at all, and when I changed it to:
#TRIGGER {A pale-skinned young man} {#sub {(Tego) %1};#CW Violet} "" {verbatim}
It did fire, however it gave me this:
(Tego) %1{(Tego) %1};#CW Violet |
|
Last edited by Anthalas on Thu Dec 17, 2009 6:31 pm; edited 2 times in total |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu Dec 17, 2009 6:19 pm |
Oh, sorry, you need to get rid of the "verbatim" at the end. Otherwise it is trying to match () sent from the MUD. So just do:
#TRIGGER {(A pale-skinned young man)} {#sub {(Tego) %1};#CW Violet}
Also, I am considering a syntax for #SUB to add text to the beginning or end of a pattern for a future version, but we haven't settled on the proper syntax for that yet. |
|
|
|
Anthalas Newbie
Joined: 17 Dec 2009 Posts: 7
|
Posted: Thu Dec 17, 2009 6:27 pm |
I played around with it and managed to get it to display what I wanted but it feels like a crude fix.
#TRIGGER {A pale-skinned young man} {#SUB {(Tego) A pale-skinned young man} worked, without the color.
I tried:
#TRIGGER {(A pale-skinned young man)} {#sub {(Tego) %1};#CW Violet} but the output would still be (Tego) %1
I'm an idiot and had the special character for parameters (%) disabled... I enabled it and I'm testing it now.
edit: nope, didn't work despite enabling the special character. I'll fiddle with it some more tomorrow.
Thank you very much for your help Zugg. |
|
|
|
GeneralStonewall Magician
Joined: 02 Feb 2004 Posts: 364 Location: USA
|
Posted: Thu Dec 17, 2009 11:23 pm |
Pretty sure you can't use #cw with #sub. What you want is the %ansi() function.
#TRIGGER {A pale-skinned young man} {#SUB {%ansi((%color(magenta) + %color(hi)))(Tego) A pale-skinned young man} |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Fri Dec 18, 2009 5:29 pm |
Something is wrong with your preferences or there is some other script that is interfering with this. I just tested the original script in a blank session and it worked fine.
1) Run CMUD. Close the Session window
2) Type:
#TRIGGER {(A pale-skinned young man)} {#sub {(Tego) %1};#CW Violet}
3) Type:
#show {test A pale-skinned young man is here}
It displayed:
test (Tego) A pale-skinned young man is here
and the entire "(Tego) A pale-skinned young man" was in Violet as expected.
So it works fine for me here. #CW works fine with #SUB and the %1 works fine. |
|
|
|
|
|