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 Goto page Previous  1, 2
charneus Posted: Fri May 09, 2008 4:36 pm
A note formatter script?
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Fri May 09, 2008 10:50 pm   
 
Well, tried that, and it didn't input the colors at all. It just stripped them from the string. Hmmm... and I see what you mean about the justification. Very nice indeed.

Charneus
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Sat May 10, 2008 3:46 am   
 
It looks like the CMud's parser is interpretting the @Rwhatever as a variable reference and changing it to null. The only thing I can suggest is to replace the @'s before and after. I tried changing the preference using %pref and it didn't quite work.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Sat May 10, 2008 3:43 pm   
 
Code:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <func name="format" copy="yes">
    <value>$slist=""
$str=""
#while %regex($string,"^((?:(?:\@.)*.){1,79}(?=(?: |$)))",$str,$count) {
 $slist = %additem($str,$slist)
 $string = %right($string,$count)
}
#return $slist</value>
    <arglist>$string</arglist>
  </func>
</cmud>


To test:
Code:
$string="This is an @R@E@Fexample of a note. Each line can be no more than 79 characters long, but I do not want it to break off in the middle of a word. Therefore I need to be able to have the @Qscript detect@D the final @Eword, and if it a@Fllows the @Gline to go over 79 characters, it @Mbreaks it off to the space before and moves it to the next line."

$string2="This is an example of a note. Each line can be no more than 79 characters long, but I do not want it to break off in the middle of a word. Therefore I need to be able to have the script detect the final word, and if it allows the line to go over 79 characters, it breaks it off to the space before and moves it to the next line."

#for @format($string) {#show %i}
#echo *****
#for @format($string2) {#show %i}
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
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