|
hogarius Adept
Joined: 29 Jan 2003 Posts: 221 Location: islands.genesismuds.org
|
Posted: Sat Apr 26, 2008 8:12 pm
Watch window in Modus Operandi (resolved) |
I'm trying to set up a Watch window in Simutronics' Modus Operandi. (You may remember a post from me one or two years ago about this...) I've reworked the trigger so that it is less complicated, but it doesn't quite work right. The following is the Zscript for my trigger on %gsl(f)
Code: |
Wpart=%gsl(f);WText=@WText+@Wpart;#if %ends(@WText,"."|"!"|"?"|%char(34)) {#window Watch @WText;WText=""} |
As shown currently, it keeps adding @Wpart to @WText every time a new %gsl(f) is received from the MUD, but it never detects the end characters of ., !, ? or " and thus never outputs to the Watch window.
I would appreciate any suggestions. |
|
Last edited by hogarius on Sun Apr 27, 2008 3:35 am; edited 1 time in total |
|
|
|
hogarius Adept
Joined: 29 Jan 2003 Posts: 221 Location: islands.genesismuds.org
|
Posted: Sun Apr 27, 2008 1:45 am |
I was able to resolve the situation as follows. I ended up having to break the expression up in the #if to four different equations connected by logical ORs, rather than try to have all the correct ending characters as part of one group in the right side of one equation.
Code: |
#gag;Wpart=%gsl(f);WText=@WText+@Wpart;#if ((%rightback(@WText,1)={"."})||(%rightback(@WText,1)="!")||(%rightback(@WText,1)="?") ||(%rightback(@WText,1)=%char(34))) {#window Watch @WText;WText=""} |
(Code above includes an extra space after the "?" expression to allow wordwrap on the forums.) |
|
|
|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Sun Apr 27, 2008 1:57 am |
You can use %ends, but you'd still have to break it up into four separate expressions. The problem wasn't the function you chose, but the way in which you built your expression. And, you don't need to use {"."}, either. The curly brackets are superfluous here, really.
|
|
|
|
hogarius Adept
Joined: 29 Jan 2003 Posts: 221 Location: islands.genesismuds.org
|
Posted: Sun Apr 27, 2008 3:24 am |
Thanks for pointing that out, Larkin. I pretty much figured that either %ends or %rightback would work, once I got it to work with %rightback. Also, I do see that I can remove the curly braces around the "." .
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sun Apr 27, 2008 3:44 am |
If you want to do them all in one function, you could try %ismember(%rightback(@WText,1),%concat(".|!|?|",%char(34))) or something similar.
|
|
|
|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Sun Apr 27, 2008 11:37 am |
Fang's missing a quote before the comma in the %concat call, but that's a little cleaner way of doing the expression.
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sun Apr 27, 2008 11:59 am |
So I was. Fixed.
|
|
|
|
|
|