Oblivion Mod:Mod File Format/SCPT

2,207 bytes added, 20:20, 4 February 2007
SLSD Subrecord
==SLSD/SCVR SubrecordSubrecords==
SLSD and SCVR records together represent the local variables of the script. SLSD provides general info, while SCVR gives the name of the variable.
Appears to hold 24 bytes (confirmed) of data related to a local variable definition.
AppearsSLSD appears to hold 24 bytes (confirmed) of data related to a local variable definition.
{| class="greylapse" border="1" width="100%"
| Index
| 4 (dword)
| Unique index for each local variable in the script (not confirmed)? Does not follow the order of variable declaration.
| Unknown
SLSD/SCVR pairs appear in the order in which they're defined in the script at compile time. When compiling a script, the compiler will use index already assigned to the variable if it already exists in the SLSC/SCVR pair listing. If the variable is not in the list, then the next available index is assigned -- where next available index is numVars (from SCHR) plus 1.
This means:
* Changing the type of an existing variable will not affect its index number.
* Reordering variable definition will not affect their indices, though it will affect the ordering of the SLSD/SCVR pairs.
* Renaming a variable will result in a new index number being assigned, which means that savegames will effectively have the value reset. (Since savegames remember variable value by index.)
* Deleting a variable, compiling and then readding the variable will cause the redefined variable to have an new index number. This is because when the variable is deleted, it is removed from the SLSD/SCVR pair list, and so the compiler is not able to find it's old index number when the variable is redefined.
* Renaming a variable will likely cause othe scripts attempting to access it to lose it -- until they too are modified to use the new name and recompiled.
Note: It appears that the savegames store all numbers (despite their short, long, float designation) as doubles (64 bit floats). Refs are stored differently, but in the same space(?)
It seems that problems can arise if their is a conflict over what a given index means. This can happen if:
# a master defines a script with 4 variables
# a mod overrides the script and adds 2 more variables
# the master then is updated to add another variable
# player starts playing with master version 2, then loads mod (compiled on version 1 of master script), since there is now a conflict over what variable index 5 refers to.
This might in particular be a problem when a float is reinterpreted as a ref value. It is suspected that this conflict was the source of some CTDs when version 1.3 of OOO (built on top of unpatched Oblivion) was used with savegames using patched Oblivion.