Declaring variables

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
short
-32,768 to 32,767
long
-2,147,483,648 to 2,147,483,647
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 
long  myLongVariable   
float myFloatVariable 

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

Notes[edit | edit source]

  • After a script has executed values applied to a variable are NOT reset to NULL. Keep this in mind for testing purposes when writing a mod. A script writer may wish to reset a variable's value within their script accordingly for testing scenarios and then remove (or comment out) this variable resetting later before publishing.