Oblivion Mod:Cobl/Modding/GenericLore
This is Cobl's version of the generic lore script. It is being overridden to provide a means for mods to communicate some informaiton ~without~ becoming depedendent on Cobl. It's a limited use trick and we'll be using it VERY sparingly. (As of Cobl v1.42, just for enabling dual mode option icons.)
How this works. This vanilla quest script is overridden here and new variables are defined. The new variables can be used to communicate some informaiton between mods without establishing a direct dependency between the mods. E.g. Cobl can set the ref of a variable here to Cobl's options container. Other mods can then check this ref variable, and if it's not equal to zero, assume that it is the Cobl container. If the variable is not set, then Cobl is not present and the mod can treat its options in some default way.
For this to work, both Cobl and the other mod must have a copy of this script in which not only identical variables are defined, but in which those variables are all assigned the same index. It's the index that's the tricky part. The index is the internal compiled identifier of the variable. E.g. whenever one part of the game needs to refer to a variable in the script, it actually does so by the index.
And this is where things can go badly -- if one script thinks that variable number 23 is a ref that points to a container, while another script thinks that variable number 23 is an float reprenting a weight, then the miscommunication between those data types is very likely to cause CTDs or at least very odd behavior. THIS IS THE REASON FOR THE WARNINGS!
Cobl actually uses a trick to force the indices of the variables it defines to be higher than normal (starting at 100 rather than 1). This should help avoid certain bugs. But it also means that you can't just copy this script to your mod and recompile -- the indices will be different. Instead, you (as modder), should use Tes4Gecko to merge the Cobl version of this script into your mod. A special resource esp is provided for just this purpose. After the merge, be careful not to edit and recompile this script. (Recompiling by itself won't hurt, but doing so after an edit in which variables were added or removed -- even temporarily -- runs the risk of corrupting existing assigned indices.
If in doubt, you can use Tes4View to check for conflicts between the version of this script in your mod and the version in Cobl.
Why Generic Lore? GenericLore is a vanilla Oblivion quest with this script attached. Because GenericLore is already running, has a script attached, and is not common target for modification, the chances of conflict in modifying the script are very low. (Unusused test scripts were also considered, but it was figured that other modders might have thought the same thing -- and hence such "unused" scripts were actually more likely to be modified than this script.
Current variables in use:
Name | Type | Use |
---|---|---|
rLock1 | Ref | Locked with a vanilla object. |
r00 | Ref | cobOptChestRef |
i00 | Long | cobOptChestlong.state |
i01 | Long | Language setting (2 = Russian, 1 = German, 0 = English) |