comment

<< Click to Display Table of Contents >>

Manual > Script Guide > Script Ver2 (SC2 syntax) >

comment

comment

If you want to write a comment in a script, start it with "//" and then write the comment.

 

// Comments

function XXX(a, b)

{

// Comments

…

//Comments

 a = a + 1;        //Comments

 b = b + 1;        //Comments

}

 

If you want to write a multi-line comment, use:

 

// Comment 1

// Comment 2

// Comment 3

 

 

Additionally, if you enclose something between the "/*" and "*/" keywords, everything between them will be recognized as a comment.

 

/*  Comment 1

Comment 2

Comment 3 */

 

hint

The comment syntax closely follows the C language syntax.

 

 

Using comments for debugging

Comments are also often used for debugging purposes - you can comment out parts of a script to temporarily stop it from executing a part of its process.

 

Example 1) Commenting out a process

 

event OnMouseUp(button)
{
var vals = this.GetVal(g_tags);
	parent.Label1.Text = vals[0];
//	parent.Label2.Text = vals[1];
//	parent.Label3.Text = vals[2]; 
}

 

In the above example, the two lines "parent.Label2.Text = vals[1];" and "parent.Label3.Text = vals[2];" are commented out. This means that only the two commented out lines will not be executed.

 

Example 2) Comment out the entire event

 

By specifying the comment as shown below, the entire OnMouseUp event will be commented out.

 

/*
event OnMouseUp(button)
{
	var vals = this.GetVal(g_tags);
	parent.Label1.Text = vals[0];
	parent.Label2.Text = vals[1];
	parent.Label3.Text = vals[2]; 
}*/

 

This means that the OnMouseUp event will no longer exist.