Comments

From ZCWiki
Jump to: navigation, search

Comments are notes you can use to document your scripts, directly in the scripts themselves. Comments are ignored by the ZScript compiler and by the scripting engine in Zelda Classic, so they do not affect game play at all.

Syntax

ZScript

Comments in ZScript are started by two forward slashes. The comment ends automatically at the end of the line on which the comment started.

For the sake of clarity, in the examples here and in other ZScript examples, comments are shown in green text.

// This is a comment in ZScript.

Comments can be made on the same line as executable code, however the comment must appear after any executable code; the comment will extend to the end of the line.

Link->HP = Link->HP / 2;     // Cut Link's hitpoints in half.

Unfortunately, there is no "block comment" feature (like the C++ style comment /*...*/), so each line of a multi-line comment must start with the forward slashes:

// This ZScript comment
// spans several lines.


ZASM

Comments in ZASM are started by a semicolon. the comment ends automatically at the end of the line on which the comment started.

; This is a comment in ZASM.

Comments can be made on the same line as executable code, however the comment must appear after any executable code; the comment will extend to the end of the line.

WAITFRAME ; Let Zelda Classic process other events.

Unfortunately, there is no "block comment" feature (like the C++ style comment /*...*/), so each line of a multi-line comment must start with the semicolon:

; This ZASM comment
; spans several lines.