Script File Structure: Difference between revisions

Jump to navigation Jump to search
m
Convert source tags to syntaxhighlight
imported>Whocares65
mNo edit summary
m (Convert source tags to syntaxhighlight)
 
Line 15: Line 15:


=== Examples ===
=== Examples ===
<source lang="papyrus">
<syntaxhighlight lang="papyrus">
; MyScript.psc
; MyScript.psc
ScriptName MyScript
ScriptName MyScript
</source>
</syntaxhighlight>
<br>
<br>
<source lang="papyrus">
<syntaxhighlight lang="papyrus">
; HiddenScript.psc This script is hidden from the editor's normal script list, and extends ParentScript
; HiddenScript.psc This script is hidden from the editor's normal script list, and extends ParentScript
ScriptName HiddenScript Extends ParentScript Hidden
ScriptName HiddenScript Extends ParentScript Hidden
</source>
</syntaxhighlight>


== Contents ==
== Contents ==
Line 34: Line 34:


=== Examples ===
=== Examples ===
<source lang="papyrus">
<syntaxhighlight lang="papyrus">
; Call MyGlobal() in Utility, with no import
; Call MyGlobal() in Utility, with no import
Function MyFunction()
Function MyFunction()
   Utility.MyGlobal()
   Utility.MyGlobal()
EndFunction
EndFunction
</source>
</syntaxhighlight>
<br>
<br>
<source lang="papyrus">
<syntaxhighlight lang="papyrus">
; Call MyGlobal() in Utility, with import
; Call MyGlobal() in Utility, with import
import Utility
import Utility
Line 48: Line 48:
   MyGlobal()
   MyGlobal()
EndFunction
EndFunction
</source>
</syntaxhighlight>


== Whitespace ==
== Whitespace ==
Line 54: Line 54:


=== Examples ===
=== Examples ===
<source lang="papyrus">
<syntaxhighlight lang="papyrus">
; Valid use of white space (if perhaps not as readable)
; Valid use of white space (if perhaps not as readable)
x    =    (10+1*    2 ) as  float
x    =    (10+1*    2 ) as  float
</source>
</syntaxhighlight>
<br>
<br>
<source lang="papyrus">
<syntaxhighlight lang="papyrus">
; Whitespace between the two equals signs in an equality operator will be interpreted as two equals signs, and fail to compile
; Whitespace between the two equals signs in an equality operator will be interpreted as two equals signs, and fail to compile
x = = 1
x = = 1
</source>
</syntaxhighlight>
<br>
<br>
<source lang="papyrus">
<syntaxhighlight lang="papyrus">
; Whitespace between the 10 and 12 is interpreted as two numbers, 10 and 12, and not a single number 1012, and fail to compile
; Whitespace between the 10 and 12 is interpreted as two numbers, 10 and 12, and not a single number 1012, and fail to compile
10 12
10 12
</source>
</syntaxhighlight>


== Line Terminators ==
== Line Terminators ==
Line 73: Line 73:


=== Examples ===
=== Examples ===
<source lang="papyrus">
<syntaxhighlight lang="papyrus">
; Two statements separated by a line terminator
; Two statements separated by a line terminator
x = 1 + 2
x = 1 + 2
y = 2 * 3
y = 2 * 3
</source>
</syntaxhighlight>
<br>
<br>
<source lang="papyrus">
<syntaxhighlight lang="papyrus">
; One long statement broken into two lines
; One long statement broken into two lines
x = 1 + 2 \
x = 1 + 2 \
   + 3 + 4
   + 3 + 4
</source>
</syntaxhighlight>
<br>
<br>
<source lang="papyrus">
<syntaxhighlight lang="papyrus">
; Slash in this line is ignored, because it is in a comment \
; Slash in this line is ignored, because it is in a comment \
x = 1 + 2 ; This line isn't inside the above comment
x = 1 + 2 ; This line isn't inside the above comment
</source>
</syntaxhighlight>


== Comments ==
== Comments ==
Line 98: Line 98:


==== Examples ====
==== Examples ====
<source lang="papyrus">
<syntaxhighlight lang="papyrus">
; A simple single line comment
; A simple single line comment
</source>
</syntaxhighlight>


=== Multi-line Comments ===
=== Multi-line Comments ===
Line 107: Line 107:


==== Examples ====
==== Examples ====
<source lang="papyrus">
<syntaxhighlight lang="papyrus">
;/ A simple
;/ A simple
Multi-line comment /;
Multi-line comment /;
Line 114: Line 114:
y.DoCoolStuff()
y.DoCoolStuff()
/;
/;
</source>
</syntaxhighlight>


=== Documentation Comments ===
=== Documentation Comments ===
Line 121: Line 121:


==== Examples ====
==== Examples ====
<source lang="papyrus">
<syntaxhighlight lang="papyrus">
ScriptName MyCoolScript
ScriptName MyCoolScript
{Documentation for my cool script here!
{Documentation for my cool script here!
I can even use more than one line...}
I can even use more than one line...}
</source>
</syntaxhighlight>
<br>
<br>
<source lang="papyrus">
<syntaxhighlight lang="papyrus">
int Property MyProperty Auto
int Property MyProperty Auto
{This property is fun, if you set it to 1, watch cool stuff happen!}
{This property is fun, if you set it to 1, watch cool stuff happen!}
</source>
</syntaxhighlight>


[[Category:Scripting]]
[[Category:Scripting]]
[[Category:Papyrus]]
[[Category:Papyrus]]
[[Category:Papyrus Language Reference]]
[[Category:Papyrus Language Reference]]

Navigation menu