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


Joined: 27 Sep 2002
Posts: 83

PostPosted: Sat Mar 06, 2004 11:32 pm   

Script help
 
I have a trigger that will capture all says that occur when I can see them. Here is the trigger

Code:

#TRIGGER {You say: } {
  :CHANNEL:#SAYPROMPT {%time( hh:nn)}
  #CAP CHANNEL
  #GAG
  }


But sometimes it a say can be multiple lines of text like this

quote:


You say: This is a Test. This is a Test. This is a Test. This is a Test. This is a Test. This is a Test. This is a Test. This is a Test. This is a Test.
This is a Test. This is a Test. This is a Test. This is a Test. This is a Test. This is a Test. This is a Test. This is a Test. This is a Test.
This is a Test. This is a Test. This is a Test.




see how it is indented?

But I can't seem to figure out how to get it to capture the rest of the say?

As it works now this is what goes in the CHANNEL window:

quote:

17:04You say: This is a Test. This is a Test. This is a Test. This is a Test. This is a Test. This is a Test. This is a Test. This is a Test. This is a Test.



And this goes into the main mud window:

quote:

This is a Test. This is a Test. This is a Test. This is a Test. This is a Test. This is a Test. This is a Test. This is a Test. This is a Test.
This is a Test. This is a Test. This is a Test.



I'll be very very very happy if anyone is able to help :)

-fewyn
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4692
Location: Pensacola, FL, USA

PostPosted: Sun Mar 07, 2004 12:22 am   
 
some muds let you tweak to column width of the output the send you (essentially their own way to word wrap, eg. COLS) you want zmud to candle the wordwrapping to do this the easy way... ask one of the coders if there is a command for this and set it to the largest number possible, then your trigger will work.
if that doesnt do it you will need a #case statement
Reply with quote
Fewyn
Wanderer


Joined: 27 Sep 2002
Posts: 83

PostPosted: Sun Mar 07, 2004 1:34 am   
 
ah.... that works ok but it does some funky things to the mud (like i have to scroll sideways sometimes to read some room descs)... Anyone know of another way?
Reply with quote
Danlo
Magician


Joined: 28 Nov 2003
Posts: 313
Location: Australia

PostPosted: Sun Mar 07, 2004 2:09 pm   
 
If your say's are followed by a blank line, the following will work:

#TRIGGER SayCap {You say:} {}
#COND {*} {#if (%null(%line)=1) {#state SayCap 0} {:CHANNEL:#SAYPROMPT {%time( hh:nn)};#CAP CHANNEL;#GAG}} {ReParse}
#COND {*} {#state SayCap 1} {ReParse}
Reply with quote
Fewyn
Wanderer


Joined: 27 Sep 2002
Posts: 83

PostPosted: Sun Mar 07, 2004 5:47 pm   
 
That won't work.... as it will loop over and over again and finally I'll have to close zMUD manually.
Reply with quote
musishun00
Wanderer


Joined: 16 Dec 2003
Posts: 77
Location: USA

PostPosted: Sun Mar 07, 2004 9:45 pm   
 
Does it not work because you don't have a blank line after your says or for another reason?
Reply with quote
Fewyn
Wanderer


Joined: 27 Sep 2002
Posts: 83

PostPosted: Mon Mar 08, 2004 11:11 pm   
 
It doesn't give a blank line... it indents the next line of text.
Reply with quote
Fewyn
Wanderer


Joined: 27 Sep 2002
Posts: 83

PostPosted: Thu Mar 11, 2004 2:35 am   
 
Anyone ? Please!
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Mar 11, 2004 8:45 am   
 
There's really only one way of handling multi-line operations.
1. Identify the beginning and the end.
2. Make a trigger using the beginning pattern to act on the first line and enable the other triggers.
3. Make a normally disabled trigger to match and act on every line until you come to the end.
4. Make a trigger to match the ending pattern and disable the second trigger.

Whether you use separate triggers, or just one multi-class trigger, or variables and #IFs, or some other method, the principle remains the same:
Start at the beginning, carry on until the end, and then stop.

You've identified the beginning pattern. Now, figure out how to identify the end of the text you want to capture.

This may work. If not, you've already been given several ideas which should be more than enough to give you a good start on finding your own method.
#TR capture {You say: } {:CHANNEL:#SAYP {%time( hh:nn)};#CAP CHANNEL;#GAG}
#COND {(*)} {#IF %begins( "%1", " ") {#CAP CHANNEL;#GAG} {#STATE capture 0}} {Looplines|Param=9}
Reply with quote
Fewyn
Wanderer


Joined: 27 Sep 2002
Posts: 83

PostPosted: Fri Mar 12, 2004 12:36 am   
 
omg.... i love you lightbulb it works PERFECT.... THANK YOU SO VERY MUCH.... I've been trying on my own for the last couple months and never could figure it out :D
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