Cross Script Variables
This article is actually a discussion which was brought into the Main Wiki because it has interesting or important information. It should be converted into an actual article; if you can do this, it would be appreciated.
If you are looking for a way to get the value of a variable from one script running on one object to a script running on another object I can imagine you may have entered the above article name in your search or something similar to it. As you first begin writing mods you may notice that the scripting language of Oblivion assumes the only universally accessible variables should be Global variables. This would not be terrible except that all Global variables are treated as floats. (See Floating Point.)
It is possible the time will come in writing a script for a mod when you will wish to have a repository to store variables in that can be read from and written to by any script. Fortunately this is quite possible. This article addresses a method for not only storing non-float numeric values, but also object references. This could prove very handy when creating dynamic game scenarios.
A basic scenario for creating and testing this type of functionality includes three parts.
1 - A quest script used to act as the database for storing the values. One might want to read over the following article to get familiar with Quest scripts.
2 - A script that writes a value to one of the variables in the "database" Quest script when it is activated.
3 - A script that reads a value from one of the variables in the "database" Quest script when it is activated.
(note: i will finish this article later tonight!!)