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
Maximus
Wanderer


Joined: 21 May 2001
Posts: 59
Location: USA

PostPosted: Fri Jul 19, 2002 8:42 pm   

Mutli-line triggering
 
I feel somewhat stupid asking this considering what I already know about zMud, but maybe I'm missing something.

Okay, is there any way to make one trigger to handle a pattern which may or may not be on more than one line?

For example, Achaea has skills which alert you to the presence fo people in adjacent rooms. unfortunately, the output of the skill gives you the FULL name of the player and the room name. Based on the length of either name, the output can be anywhere from one to three lines long (a three liner is rare).

An example:
Your enhanced senses inform you that Fuzzy has entered The Temple nearby.

OR

Your enhanced senses inform you that Prestidigitarious, Mastermind of Extra-long Names has entered The Temple Which is Built in Honor of a Particular God nearby.

Currently I have three or four triggers that attempt to handle all cases in a similar manner by gagging the output and replacing it with an echo that says:
>-- Whoever is nearby --<

Unfortunately, none of the triggers work exactly as planned. Some lines are not gagged, or, in one rather odd case, a name which started on the first line and ended on the second was split up and echoed like this:
>-- Prefix Joe
of Suffix is nearby --<

The worst part about the above case is that it kept trying to enter the second line as a command instead of an echo. The only thing I could think was that a carriage return was somehow being embedded in there, but I couldn't figure out why or how to fix it.

Here are my triggers:
#TRIGGER {Your enhanced senses inform you that (*)$(*)has} {#GAG;#GAG -1;#SAY ~>-- %1%2 is nearby --~<}
#TRIGGER {Your enhanced senses inform you that (*) has (*)$(*)nearby.} {#GAG;#GAG -1;#SAY ~>-- %1 is nearby --~<}
#TRIGGER {Your enhanced senses inform you that (*) has entered (*) nearby.} {#GAG;#SAY ~>-- %1 is nearby --~<}

Any ideas how to make this more efficient/work?

-Maximus

---Edited---

I'd also like to add that I tried once to capture all says, tells, etc. to a different window but had much the same problem with multi-line messages as above. If anyone could tell me how to effictively do that as well, I would appreciate it.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Jul 19, 2002 10:03 pm   
 
The detect/locate/where is easy because of the period at the end. So here is your solution

#VAR Locate {}
#TR {^Your enhanced senses inform you that *} {Located=%trigger;##GAG;IF (%ends(%trigger,".") {ParseLocate} {#T+ LocateCapture}}
#ALIAS ParseLocate {Locate=%remove("Your enhanced senses inform you that ",@Locate);Locate=%left(@Locate,%pos(" has entered",@Locate));#ECHO ~>-- @Locate is nearby --~<}
#CLASS LocateCapture
#TR {^*$} {Located=%concat(@Located," ",%trigger);#GAG;#IF (%ends(%trigger,".") {#T- LocateCapture;ParseLocate}}
#CLASS 0

Practically all variable multiline captures work best if a similar attack is used, look for something that consistently signals the end of the text.
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