Category:Variables/Test
Attempt 3Edit
If this is your first experience with Variables, you may want to read up on it here. Variables are incredibly useful and are necessary for flags, using some OBSE functions, loops and more.
In Oblivion, there are 3 variables types that can be used to represent:
- Integers - whole numbers from -2,147,483,648 to 2,147,483,647
- Floats -
- Records (also known as References) - EditorIDs, or more precisely, FormIDs, of any object in the game
Like other programming languages, you need to declare the variable type before using the variable. However, unlike other programming languages Oblivion will, in certain instances, ignore your declaration and define the variable as a different type. For this reason, variables are explained in two different sections
- Script Variables - Can store records, more flexible
- Globals - Easier to set up, easier to use across multiple scripts, can't store references or integers
Game SettingsEdit
Game Settings are not variables in the same sense as Script Variables and Globals. They cannot be used in place of a number. For instance,
float T1CalMagMult ... set T1CalMagMult to fPotionT1CalMagMult
will prevent the script from ever running. Instead you need to use
float T1CalMagMult ... set T1CalMagMult to (GetGameSetting fPotionT1CalMagMult)
Attempt 2Edit
If this is your first experience with Variables, you may want to read up on it here. Variables are incredibly useful and are necessary for flags, using some OBSE functions, loops and others.
In Oblivion, variables are used to represent either numbers or records. They are used in place of the number or record. For example, this
player.AddItem Apple 10
is the same as
long ItemCount ... set ItemCount to 10 player.AddItem Apple ItemCount
Oblivion uses 3 variable types
- Integer
- Float
- Record/Reference
ImportantEdit
Oblivion does not treat all variables as they are declared.
- All global variables are treated as floats, regardless of their declared variable type.
- All script integer variables are treated as longs, even if declared as short.
Attempt 1Edit
Variables can be used in place of any number or reference. For example, this
player.AddItem Apple 10
is the same as
long ItemCount ... set ItemCount to 10 player.AddItem Apple ItemCount
This flexibility allows you to... do stuff like looping, add up stuff, etc.
long ItemCount ... set ItemCount to 10 set ItemCount to (ItemCount * 2) player.AddItem Apple ItemCount
There are actually 3 types of variables in Oblivion: Script Variables, Global Variables, and Game Settings. In a sense, all of these should be the same. However, Oblivion treats them differently so they have been separated into 3 different pages.
- Script Variables are the most flexible
- Global Variables can only be used to store numbers, and all of them are treated as floats
- Game Settings can't be used as demonstrated above
Ok, this needs to be reorganized, but it's a start
Specifically, though, are there any other variable types that I'm missing - do dialogue or quest conditions work differently?
This category currently contains no pages or media.