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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
hogarius
Adept


Joined: 29 Jan 2003
Posts: 221
Location: islands.genesismuds.org

PostPosted: 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
Reply with quote
hogarius
Adept


Joined: 29 Jan 2003
Posts: 221
Location: islands.genesismuds.org

PostPosted: 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.)
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: 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.
Reply with quote
hogarius
Adept


Joined: 29 Jan 2003
Posts: 221
Location: islands.genesismuds.org

PostPosted: 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 "." .
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: 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.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)

Last edited by Fang Xianfu on Sun Apr 27, 2008 11:59 am; edited 1 time in total
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: 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.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sun Apr 27, 2008 11:59 am   
 
So I was. Fixed.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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