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
Private
Adept


Joined: 10 Jan 2002
Posts: 264
Location: USA

PostPosted: Wed Aug 01, 2012 1:10 pm   

%char(10) no new line in #SHOW [solved use %crlf]
 
cmud 3.34, zmud 7.21...

in zmud... #SHOW test%char(10)test
test
test

cmud...
testtest


zmud... #SHOW {test&#269~;test}
test
test

cmud...
testĨtest

i have a very large script that uses that method to do ONE show with multiple lines... cant split it up, and using stripansi for other purposes..

------------------------------------------------------------------------------------------------------------------
Just for sshowing the actual code....
#SHOW {%ansi(@theme_color1)DB Id:%ansi(@theme_color2) %replace(%replace(%replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %stripansi( %dbget( %i)), mob_level, " %ansi(@theme_color1)Level: %ansi(@theme_color2)"), mob_name, " %ansi(@theme_color1)Name: %ansi(@theme_color2)"), mob_speedwalk, " %ansi(@theme_color1)Speedwalk: "), mob_roomname, " %ansi(@theme_color1)Room: %ansi(@theme_color2)"), "mo ", " "), Notes, " %char(10)%ansi(@theme_color1)Notes: %ansi(@theme_color2)"), mob_zone, " %char(10)%ansi(@theme_color1)Area: %ansi(@theme_color2)"),"good",'%ansi(high,yellow)good'),"evil",'%ansi(red)evil'), mob_align, " %char(10)%ansi(@theme_color1)Alignment: ")}


output in zmud:

DB Id: 4267 Name: The angel, Felicity Level: 35
Area: War of the Wizards Room: The white monolith
Alignment: neutral Speedwalk: 14699 go
Notes: none

DB Id: Num=4267mo| %ansi(@theme_color1)Name: %ansi(@theme_color2)=The angel, Felicity| %ansi(@theme_color1)Level: %ansi(@theme_color2)=35| %char(10)%ansi(@theme_color1)Area: %ansi(@theme_color2)=War of the Wizards| %ansi(@theme_color1)Room: %ansi(@theme_color2)=The white monolith| ~&~#269~;%ansi(@theme_color1)Alignment: =neutral| %ansi(@theme_color1)Speedwalk: =14699| ~&~#269~;%ansi(@theme_color1)Notes: %ansi(@theme_color2)=none

the reson a lot of MXP subs didn't kick in is it's all on one line... i need 4.. how do i acheive this using the above code in cmud?


Last edited by Private on Wed Aug 01, 2012 5:01 pm; edited 1 time in total
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Wed Aug 01, 2012 1:16 pm   
 
I forget what ascii value 10 equates to, but you want #13 instead.
_________________
EDIT: I didn't like my old signature
Reply with quote
Private
Adept


Joined: 10 Jan 2002
Posts: 264
Location: USA

PostPosted: Wed Aug 01, 2012 1:23 pm   
 
%char(10) is newline, %char(13) is carraige return... nonetheless...

#show {test%char(13)test}
test

in cmud only one "test" shows.

In zmud %char(13) shows as "testtest"

Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Wed Aug 01, 2012 3:44 pm   
 
Why not use the %crlf predefined variable? That was available in zmud too, I'm pretty sure...
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Aug 01, 2012 4:33 pm   
 
In addition to %crlf, both Cmud and Zmud also have %cr and %lf.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Aug 01, 2012 4:39 pm   
 
The reason that %char(13) acts differently in Cmud than in Zmud is technically because of a bug in Zmud. Character 13 is a carriage return, which in Windows is supposed to return the cursor to the start of the line without going to a new line. Cmud treats it correctly--the second "test" overwrites the first one. Zmud basically ignored the character 13 in your test.

To start text at the beginning of a new line in Cmud (and in Zmud) you need a CR and an LF, because that is the Windows standard. The predefined variable %crlf was created for exactly this purpose.
Reply with quote
Private
Adept


Joined: 10 Jan 2002
Posts: 264
Location: USA

PostPosted: Wed Aug 01, 2012 5:01 pm   
 
thanks...

#SHOW test%crlf~test works as expected.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Wed Aug 01, 2012 5:25 pm   
 
What is perhaps more interesting is that %cr works no differently for me than %crlf. Not sure this is a bug (could even bea case of command abbreviation), but it's clear Cmud isn't applying this cr vs lf distinction in all cases.
_________________
EDIT: I didn't like my old signature
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Wed Aug 01, 2012 7:33 pm   
 
Hmm... %cr works identically to %char(13) for me (only one test shows, because the second is overwriting the first).
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