Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Mon Aug 30, 2010 9:13 pm   

#PRINT and using special characters
 
Okay up until now the following worked just fine:

Code:
#print {<color maroon>   |%repeat("=", 12)|</color>}


It would print out:

Code:
   |============|


However, now it prints out as the following:

Code:
"   |============"|


So I tried this:

Code:
#print {<color maroon>   ~|%repeat("=", 12)~|</color>}


and it printed out correctly as:

Code:
   |============|


What changed here and is there now a problem with adding "|" in a #print statement? Perhaps I should have done this differently or used %concat but it always worked before and saved writing extra code for a %concat. Escaping them isn't a big deal either, but I am not sure why it would interpret the pipe character like that.

Edit: Also the first quotation mark is not colored maroon while the rest is. What I found is that if you escape only one of the | characters it will print correctly. It doesn't matter which one. However, if you don't escape either one of them it prints it out partially colored with quotation marks on the screen.
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Mon Aug 30, 2010 9:26 pm   
 
I'm just going to use %concat instead like I probably should have done in the first place but I thought it was interesting.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Aug 30, 2010 10:18 pm   
 
It's because the | character within {} is reserved for creating string lists now. You can either use ~ before the | like you did, or put " around the | like this:
Code:
#print {<color maroon>   "|"%repeat("=", 12)"|"</color>}
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Tue Aug 31, 2010 9:21 am   
 
Yeah I figured that out after posting. Laughing
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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