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
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Fri May 16, 2008 4:47 pm   

Using #psub to put in a linefeed
 
I am trying to do some substitution using #psub, and finding a minor problem. I want to put a linefeed in the middle of the text. As an example, the mud sends:
Code:
Some long description blah blah blah which wraps
  in the middle.  More text.
The next line.

and I want it to come be displayed as:
Code:
Some long description blah blah blah which wraps
  in the middle.
  More text.
The next line.

This is working fine. The problem is if the line from the mud is short enough that cmud doesn't wrap it:
Code:
Short description with no wrap.  More text.
The next line.

When I put the linefeed in, I get this:
Code:
Short description with no wrap.
  More text.  The next line.

Is this a bug? Does anyone have a suggestion? What I'm doing is a bit more complex than that, of course. Here is some sample code, which would be within a trigger for "More text." The problem only shows up if cmud isn't wrapping the initial text.
Code:
$line = %line
#call %match($line, "(*) (More text.)(*)", $d1, $d2, $d3)
$line = %concat($d1,$d3%lf,$d2)
$extra = $d2
#if %match($line, "(*) (Other text.)(*)", $d1, $d2, $d3) {$line = %concat($d1,$d3);$extra = %concat($extra,%lf,$d2)}
$out = %concat($line,%lf,$extra)
#psub $out
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