Difference between revisions of "Cross Script Variables"

422 bytes added ,  19:27, 22 December 2010
Found the solution!! Working on the article!!
imported>DragoonWraith
(discussion tag)
imported>Bruneauinfo
(Found the solution!! Working on the article!!)
{{Discussion}}
 
IIf hadyou beenare looking for a way to get the value of a variable from aone script running inon one object to a script running inon another object. I amcan notimagine sureyou thismay workshave entered the wayabove Iarticle believename in your search or something similar to it. does,As andyou Ifirst planbegin onwriting testingmods thisyou inmay notice that the nearscripting futurelanguage 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.
However, if it is indeed the way to do this I'll go ahead and add that finding this particular functionality was NOT very intuitive on the wiki. So I went ahead and created this entry using the search parameter I felt was most intuitive for finding this in the future. So when I or anyone else using the Wiki is looking for this information they may be able to find it more readily.
 
A basic scenario for creating and testing this type of functionality includes three parts.
If it turns out this functionality is just not available, or not what I thought it was, then I hope this page is left alive for the sake of posterity.
 
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]].
Here's the function I'm referring to: [[GetScriptVariable]]
 
2 - A script that writes a value to one of the variables in the "database" Quest script when it is activated.
Ironically if a person searches the Wiki using the title of this entry they will not find this function directly although [[GetQuestVariable]] will be listed.
 
3 - A script that reads a value from one of the variables in the "database" Quest script when it is activated.
(''They'll find it now, of course!!'')
 
(note: i will finish this article later tonight!!)
 
===See Also===
 
*[[GetScriptValue]]
*[[GetGlobalValue]]
*[[GetQuestVariable]]
Anonymous user