Difference between revisions of "Declaring Variables"

From the Fallout3 GECK Wiki
Jump to navigation Jump to search
imported>Cipscis
(Correcting information about "int" variables)
imported>Dandys
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
;int:-2,147,483,648 to 2,147,483,647
;short:-32,768 to 32,767 (integers only)
;long:-2,147,483,648 to 2,147,483,647 (integers only)
;float:-3.402823×10<sup>38</sup> to -1.175494×10<sup>−38</sup>, 0 and 1.175494×10<sup>−38</sup> to 3.402823×10<sup>38</sup> (precision of 7 digits)
;float:-3.402823×10<sup>38</sup> to -1.175494×10<sup>−38</sup>, 0 and 1.175494×10<sup>−38</sup> to 3.402823×10<sup>38</sup> (precision of 7 digits)
;ref:A pointer to a reference
;ref:A pointer to a reference
Line 5: Line 6:
You can declare three types of variables through scripts and as [[Globals|global]] variables. Variable names are not case sensitive. Declare with type and name:
You can declare three types of variables through scripts and as [[Globals|global]] variables. Variable names are not case sensitive. Declare with type and name:
<pre>
<pre>
int myIntVariable
short myShortVariable
float myFloatVariable  
float myFloatVariable  
</pre>
</pre>
"Short" variables can also be declared with the keyword "int", and "ref" variables can use the keyword "reference".
   
   
A local variable can be placed anywhere within the script code, it only needs to be declared before the first command that uses it. Usually you declare all variables on top of the script, though, to improve the script's readability.
A local variable can be placed anywhere within the script code, it only needs to be declared before the first command that uses it. Usually you declare all variables on top of the script, though, to improve the script's readability.

Latest revision as of 14:50, 15 October 2011

short
-32,768 to 32,767 (integers only)
long
-2,147,483,648 to 2,147,483,647 (integers only)
float
-3.402823×1038 to -1.175494×10−38, 0 and 1.175494×10−38 to 3.402823×1038 (precision of 7 digits)
ref
A pointer to a reference

You can declare three types of variables through scripts and as global variables. Variable names are not case sensitive. Declare with type and name:

short myShortVariable 
float myFloatVariable 

"Short" variables can also be declared with the keyword "int", and "ref" variables can use the keyword "reference".

A local variable can be placed anywhere within the script code, it only needs to be declared before the first command that uses it. Usually you declare all variables on top of the script, though, to improve the script's readability.


Scripts can also declare and use reference variables:

ref      myRefVariable