|
Gnord Beginner
Joined: 05 Jul 2006 Posts: 15
|
Posted: 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. |
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: 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 :) |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: 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 |
|
|
|
Atreides_096 Wanderer
Joined: 21 Jan 2005 Posts: 99 Location: Solvang, CA
|
Posted: 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 |
|
|
|
Gnord Beginner
Joined: 05 Jul 2006 Posts: 15
|
Posted: 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.
|
|
|
|
Atreides_096 Wanderer
Joined: 21 Jan 2005 Posts: 99 Location: Solvang, CA
|
Posted: 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" ;)
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: 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 |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: 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
|
|
|
|
|
|