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
jakj
Novice


Joined: 30 Apr 2006
Posts: 45

PostPosted: Tue Nov 23, 2010 1:01 pm   

Multiline Description Capture Into Variable (Newlines Preserved)
 
I want to create a trigger that captures the text between the tags, with newlines preserved, and stores it into a variable. I want to do this without creating a secondary capture trigger and using #t+/#t-, or creating some sort of "CurrentlyCapturingDesc" boolean variable. (I would prefer to do it with a multistate trigger.) Is it possible?

Code:
{rdesc}
  The courtyard wall curves around here and meets the Academy proper. The
marble walls of the Academy rise above you, shadowing this scenic corner of
the courtyard. Tall yew trees stretch upwards, dwarfed by the building, and
cool grass stretches south to meet a flagstone path. Bright windows glimmer
from the second floor of the academy, but there are none to allow viewing on
the first floor.
{/rdesc}
[/b]
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue Nov 23, 2010 2:05 pm   
 
With newlines preserved? What do you intend to do with the variable afterwards? Carriage returns imbedded in variables can cause problems, depending on what you intend to do with it.

Yes, this could be done with a multistate trigger. Name the trigger something like "DescCap". State 0 of the trigger would fire on "{rdesc}" and probably should clear the variable, just to be sure it is blank. State 1 of the trigger should be a Manual type, with a pattern of "(*)". This state would concatenate a carriage return and the captured line to the variable. There are two ways of ending the capture and resetting the state:
1) Have state 1 of the trigger test whether the line is "{/rdesc}", and if so, execute: #STATE DescCap 0; #EXIT
2) Have state 0 of the trigger enable a secondary trigger named DescCapEnd whose pattern is "{/rdesc}". This secondary trigger would execute: #STATE DescCap;#T- DescCapEnd
Reply with quote
jakj
Novice


Joined: 30 Apr 2006
Posts: 45

PostPosted: Tue Nov 23, 2010 2:20 pm   
 
I'm just going to use a #call %roomdesc to put it into the mapper. Aardwolf doesn't send the room description through GMCP (and it would be dumb if it did, so I'm glad it doesn't :P), so that's the only thing the mapper doesn't get automatically. I'll just make a quick little macro I can press to update the description of the room I'm in with the one I most recently saw.
Reply with quote
jakj
Novice


Joined: 30 Apr 2006
Posts: 45

PostPosted: Tue Nov 23, 2010 4:26 pm   
 
Yeah, that works. I'm assuming "%crlf" is the correct way to embed a newline?
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue Nov 23, 2010 4:30 pm   
 
Yes, %crlf is correct. Did you get it to work?
Reply with quote
jakj
Novice


Joined: 30 Apr 2006
Posts: 45

PostPosted: Wed Nov 24, 2010 2:46 am   
 
Yes, it works perfectly. Thank you. :-)
Reply with quote
Moo
Apprentice


Joined: 10 Apr 2009
Posts: 145

PostPosted: Sun Nov 28, 2010 12:22 pm   
 
Is there no command in your mud to turn off server-side linewrapping?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Nov 28, 2010 5:02 pm   
 
Nope, Aardwolf doesn't do linewrapping. There are places (room descriptions, note editor, etc) where the line is limited to around 80 characters, but other than that it all comes in one giant line.
_________________
EDIT: I didn't like my old signature
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