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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Gnord
Beginner


Joined: 05 Jul 2006
Posts: 15

PostPosted: Thu Jul 13, 2006 4:36 pm   

Comments in import/export text
 
let's say I have an alias:

#alias {test} {
#echo this is the first line
;this is a comment
#echo this is the second line
}

If you try to export text and then import text this alias, it will not work anymore. (IE the comment will not be a comment anymore)

I propose changing the comment symbol from ; which is "equivalent" to a line return in trigger language, to #comment. #comment could be logically equivalent to #noop, except #comment will give the blueish italics similar to the way the current comment lines work.
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Thu Jul 13, 2006 11:44 pm   
 
#noop does absolutely nothing other than discard anything passed to it and thus can be used for comments and is great at the start of a line, // can be used to comment after a command that you want sent. Since ; is the default special character for seperator I'm surprised it was made into a comment character and not at all surprised in breaks in an export/import scenario.

I would recommend using solely #noop to comment with but that does tend to confuse some people and I guess that #comment may be a welcome addition to CMUD, perhaps you should mention it in the CMUD Beta Forum.
_________________
Taz :)
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Fri Jul 14, 2006 3:17 am   
 
// happens to work at the beginning of the line. And for some reason ; would never work as a comment character for me. ZMud would always parse it as a separator.
_________________
EDIT: I didn't like my old signature
Reply with quote
Atreides_096
Wanderer


Joined: 21 Jan 2005
Posts: 99
Location: Solvang, CA

PostPosted: Fri Jul 14, 2006 7:41 am   
 
Using ; as a comment character is an option in the zmud preferences, in #menu {View|Preferences|General|Script Parser|General Parsing}, as "Allow ; comments" ... I'm sure you knew that :P But just in case someone else reading the string got misled by your statement...

Anyway, using // as a comment will occasionally break importing as well, though I have not figured out exactly what conditions cause it to occur, but the problem is the same as using a ; to parse - when you import, it counts as a line break, and whatever trigger or alias or etc is being imported will be broken, though the rest of the script will import properly, so it is possible to do a search for ";;" or "//" depending on comment preference and manually readd the broken trigger/alias/etc.

The only issue with using #noop to comment is that it does not support multi-line useage or useage of special characters. For multiline, that's fine, juse use #noop at the start of each line with manual breaks.. but when commenting code, if you use pretty print, the editor will view it as incorrect syntax with any special character in the line, and you'll be unable to debug... I actually use #0 {comment} for my commenting now. It works surprisingly well ;)

Code:
#0 {
code line 1
code line 2
code line 3
}
and etc
Reply with quote
Gnord
Beginner


Joined: 05 Jul 2006
Posts: 15

PostPosted: Fri Jul 14, 2006 7:17 pm   
 
I must say "OOOH" and "AHHH" at the #0 commenting idea. How did you come up with that, accident? I can't find a place where that command is listed anywhere, but surprisingly it does indeed work very nicely.
Reply with quote
Atreides_096
Wanderer


Joined: 21 Jan 2005
Posts: 99
Location: Solvang, CA

PostPosted: Fri Jul 14, 2006 8:23 pm   
 
hehe.. I was actually looking for a way to "clean up" a really long alias that was very hard to read, and I came up with the idea of using #1 {} to break up the sections of the alias, utilizing pretty print to make it much more readable. Then one day I wanted to disable one section of the alias, and I looked at it and said "oh, perfect, I'll just make the #1 a #0" ;)
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Fri Jul 14, 2006 10:44 pm   
 
#0, etc is a shortcut for the #REPEAT command, which executes the code block that number of times--as fast as it possibly can.
_________________
EDIT: I didn't like my old signature
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sat Jul 15, 2006 1:56 am   
 
Atreides_096 I love you! I would have never thought of #0 and #1 to breakup long triggers and comments, Hmmm I wonder if this will still work in Cmud
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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