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


Joined: 14 Aug 2004
Posts: 1269

PostPosted: Sun Oct 14, 2007 10:54 pm   

[2.06] %time( aaa c) eats spaces
 
#show %time( aaa c)
Sun14/10/2007 23:50:00

Workaround:
#show %time( "aaa c")
Sun 14/10/2007 23:51:36

First one was fine in zMUD.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Mon Oct 15, 2007 12:36 am   
 
Taken directly from the zMud help. I should know I wrote some of the examples for it, and documented all the character codes.
Quote:
#SAY %time("aaa aaaa")
displays the day of the week in short and long format
#SH %time("hh#nn#ss")
(with German localization) displays eg.: 18#26#13

So the quotes have always been the suggested way of doing more complex strings.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Seb
Wizard


Joined: 14 Aug 2004
Posts: 1269

PostPosted: Mon Oct 15, 2007 1:16 pm   
 
Yeah, I checked that myself, but I thought I'd still mention it, as I reckon the %time() function could be made not to eat spaces, and provide greater zMUD compatibility.
Reply with quote
Zugg
MASTER


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

PostPosted: Mon Oct 15, 2007 6:06 pm   
 
Sorry, but whenever you want to preserve spaces in CMUD you need to use the " quotes. These functions like %time() take a *string* argument, and while CMUD allows you to enter plain text without " quotes as a string, as soon as you start using spaces, they get stripped unless you use quotes. This happens everywhere in CMUD, not just in %time(), so it's just a good idea to start using quotes.

Since a lot of people learn to program the first time using zMUD/CMUD, I think it's important to teach them better programming habits. zMUD did a poor job of this. In a way, zMUD was like the early versions of Internet Explorer which would accept all sorts of bad HTML syntax. Microsoft felt that it was better to try and guess as to what was intended and still try to display the bad web page, rather than reporting an error. This led to some web designers getting lazy about their pages and the HTML standards, and it became quite a mess. It was only with more standards-compliant browsers like Firefox, Opera, etc that the situation improved because now web designers actually needed to pay more attention to the standards and proper syntax.

In any other language that I can think of, you *must* enclose strings within some kind of quotes.

Yes, it's a zMUD compatibility issue, and there isn't any way to catch it in the Compatibility Report. But hopefully once someone has learned about it, then they will produce better scripts in the future.
Reply with quote
Seb
Wizard


Joined: 14 Aug 2004
Posts: 1269

PostPosted: Mon Oct 15, 2007 7:09 pm   
 
OK, at least with this one I can fix my scripts in zMUD, so that when I reimport them into CMUD I don't have to re-change them.
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