I search for solutions in this order: Past Code, Unreal Source, Wiki, BUF, groups.yahoo, google, screaming at monitor. – RegularX

Difference between revisions of "Comments"

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
m (Reverted edits by ErortRclib (Talk); changed back to last version by Azrael)
Line 1: Line 1:
 
'''Comments''' are a way of inserting text into [[UnrealScript]] code to remind yourself of what the code is doing, or to give a summary of the code file. Comments will be ignored by the compiler, so they can also be used to temporarily 'disable' a line of text.
 
'''Comments''' are a way of inserting text into [[UnrealScript]] code to remind yourself of what the code is doing, or to give a summary of the code file. Comments will be ignored by the compiler, so they can also be used to temporarily 'disable' a line of text.
  
Anything on a line after the special comment symbol '''//''' is a comment. For example, many official Unreal Tournament files have headers such as this:
+
[[UnrealScript]] supports two kind of comments a single comment and a multiple line comment.
 
+
<br>
<uscript>//=============================================================================
+
single line comments are used like this
// A sticky note.  Level designers can place these in the level and then
+
<uscript>
// view them as a batch in the error/warnings window.
+
// The commented declaration would also make the compiler ignore the declaration therefor it can be useful to disable declarations
//=============================================================================
+
// for various reasons such as testing and debugging.
class Note extends Actor
+
//var int TestVar;
placeable
+
</uscript>
native;
+
and multiple line comments are used like this.
 
+
<uscript>
#exec Texture Import File=Textures\Note.pcx Name=S_Note Mips=Off MASKED=1
+
/**
 
+
  * NOTE: Never change the value of this variable to -1! the class functions always expect it to be a positive-only value!.
var() string Text;
+
*/
 +
var int TestVar;
 
</uscript>
 
</uscript>
  
To disable a line of text, simple insert the // before it, like this:
+
Because the [[UnrealScript]] language commenting style is very similar to other programming languages commenting styles, the following link might be useful
<uscript>simulated function ShaderAction( Shader sh )
+
<br>
{
+
[http://en.wikipedia.org/wiki/Comment_(computer_programming) Wikipedia Comment].
//log("ShaderAction " $ sh );
+
 
+
switch( MatTriggerAction )
+
{
+
case MTA_SwapShaderSpecular:
+
sh.Specular = SwapMaterialA;
+
break;
+
}
+
  
}</uscript>
+
{{navbox unrealscript}}

Revision as of 21:41, 21 April 2010

Comments are a way of inserting text into UnrealScript code to remind yourself of what the code is doing, or to give a summary of the code file. Comments will be ignored by the compiler, so they can also be used to temporarily 'disable' a line of text.

UnrealScript supports two kind of comments a single comment and a multiple line comment.
single line comments are used like this

// The commented declaration would also make the compiler ignore the declaration therefor it can be useful to disable declarations 
// for various reasons such as testing and debugging.
//var int TestVar;

and multiple line comments are used like this.

/**
 * NOTE: Never change the value of this variable to -1! the class functions always expect it to be a positive-only value!.
 */
var int TestVar;

Because the UnrealScript language commenting style is very similar to other programming languages commenting styles, the following link might be useful
Wikipedia Comment.