Talk:Cross Script Variables

From the Oblivion ConstructionSet Wiki
Revision as of 13:36, 24 December 2010 by imported>DragoonWraith
Jump to navigation Jump to search

I'm not sure this page is particularly warranted; the problems with the search engine are multitudinous, but we can't have a separate page for every one.

If this is to be a tutorial of some kind for a particular method of accessing script variables, then it should be written up like one.

If it is intended only as a way to find the GetScriptVariable page, a better answer would be to create it as a Redirect, which I can help with if desired.

But if the creator could please explain the purpose of this page, that would help. As is, it's not really up to Wiki standards.
Dragoon Wraith TALK 19:34, 18 December 2010 (EST)

I think if you review it now you'll see it is improved from its original form and serves a purpose.
--Bruneauinfo 23:04, 22 December 2010 (EST)
I think, actually there already is a page like this. See this: Linked List Tutorial
--Diarrhoe 09:27, 23 December 2010 (EST)
My page is A - Complete, B - Works perfectly as written, and C - a whole lot easier to read and understand than the referenced article. I'm not creating a linked list with this functionality. I'm demonstrating the simple, BASIC functionality that allows storage of variable values in a central location that all other scripts can write to and read from. It's more of a Scripting 101 topic than an advanced database topic. It allows two separate scripts to communicate with each other on a basic level - a feature not apparent in the design of Oblivion (although this does give me an idea now...).
Granted the title of the article may not be appropriate. And perhaps there is an even easier way to do what I'm proposing here that IS a native Oblivion/OBSE function. Perhaps: Cross-Script Data Storage or something similar would be a better title. Still, the name of the article should reflect something a typical modder is going to be searching for when they type in the search bar. Otherwise no one will ever find it.
From what I've learned here on the Wiki I've taken three concepts mentioned in more than three different articles and tied them together in one article that demonstrates how to get this functionality to work. I studied the wiki for more than a few days trying to get this functionality to work. From my work I've concluded the syntax presented in various articles on this wiki relating to this topic where incorrect. I have added notes in articles where appropriate. --Bruneauinfo 12:05, 23 December 2010 (EST)
I'm about to head out, so I can't read the article right now, but as long as it's actually an article and not "GetScriptVariable was hard to find, so this page helps find it!", that's fine.
As for the Linked List Tutorial... yeah, no. That tutorial is old (as in, written within months of Oblivion's release), and it never worked as intended because of the unreliability of PlaceAtMe. At this point, it's mostly a testament to the really cool work that Tegid and MrFlippy did with Oblivion script early in Oblivion's life.
Dragoon Wraith TALK 13:26, 23 December 2010 (EST)
It is no longer a discussion, and only vaguely makes mention of its original content as an aside to why it is currently named as it is. It's actually a very simple concept - but I think it's very useful and needed to be drawn up. I would very much like to see input from someone who has tried it out. --Bruneauinfo 13:51, 23 December 2010 (EST)
I did like the article.
I've been using this concept for ages. I usually have hundreds or thousands of vars stored in my 'Global' quest.
There are a few things you could correct/adjust/clarify:
  • There is no need for the gamemode statement in the quest script. Just the variables work fine. (although this is a nice place to put initialization code wrapped in a GetGameLoaded condition)
  • You CAN create variables dynamically using OBSE arrays.
  • You must not only declare a variable in the quest script, but also compile the quest script before using the var in other scripts
  • I was about to write that "MyQuest".refVar does not work, but, surprisingly, it does. Anyway, there is no need for the quotation marks. MyQuest.refVar seems cleaner and simpler. Please review your tests and remove your comments saying the quotation marks are required.
  • The same is true for "ObjectReference"
  • Object scripts work fine for this purpose, too.
  • All kinds of vars are supported. OBSE included.
  • You may also want to mention that if you reorder the vars in the quest script, all scripts that use any of those vars must be recompiled.
And I suggest you remove the Discussion tag from the article.
QQuix 16:42, 23 December 2010 (EST)
On your comment about the use of quotations, believe me I tried many, many combinations trying to get this to work. I picked up the feature from the GetScriptVariable and GetQuestVariable pages. Many, many attempts later I figured out the only way to get it to work was to use the quotes. Yes, it surprised me too, but it was the only way I could get it to work. In fact I was right into the point of giving up completely and throwing up my hands on this when I figured out using quotation marks made it work. It was with great relief when I got it working. Granted since you use this feature all the time I can't help but imagine you're not saying this lightly. I would like to figure out what could have caused the problem for me. Perhaps it has something to do with compiling my scripts as I was trying to find the right combinations to get it to work -- and the feature just so happens to work with or without quotes. Perhaps quotes are just ignored. --Bruneauinfo 17:37, 23 December 2010 (EST)
On another look - I believe the reason quotes may be required is because I began the name of my Quest with numbers (in my testing at least). Same goes for my object reference. Interesting if it's true. If it is true then quotes are only required if references begin with a number. --Bruneauinfo 17:38, 23 December 2010 (EST)
That might be it. Probably this is one of the reasons there is a general best practices recommendation of never starting EditorIDs with numbers. The CS does not like it. Sooner or later you will get into trouble.QQuix 19:06, 23 December 2010 (EST)
I just caught site of that particular best practice while searching one of the forums for something entirely different. Oh well... tested and the numbers WERE the problem for certain. The article has been edited to reflect this. --Bruneauinfo 22:05, 23 December 2010 (EST)
Numbers starting filenames, editor IDs, and script variables are all very poor practices and strongly recommended against, here and elsewhere. I think having a specific note to that effect here is a bit out of place, but this has been a perennial problem at the Wiki - how do you handle little tidbits like that that everyone should know and applies globally? There's no obvious place to put it aside from "everywhere" which obviously doesn't work.
Dragoon Wraith TALK 02:48, 24 December 2010 (EST)

Having skimmed it (about to go to sleep) - you seem to be reinventing the wheel here a little. Setting variables in that script will not "lock them in", what's happening is that you're setting them on every frame (remember that the script runs continuously). Better would be to include a doOnce variable that, once set, will stop the script from resetting those variables.

Ultimately, this is some pretty basic stuff; it seems to me that the UseReference page is probably the best place for this kind of information. I'm certainly not opposed to having this as a basic tutorial, but it does need a bit of work. I'll look more into it tomorrow.
Dragoon Wraith TALK 02:54, 24 December 2010 (EST)

I'll admit I'm just starting into scripting. I'll re write that. --Bruneauinfo 08:23, 24 December 2010 (EST)
Also, let me point out that this article was born out of some frustration on my part. If I had known from the get-go that EditorIDs shouldn't start with numbers I would have gotten this working from the notes on GetScriptVariable and GetQuestVariable in the first place. But the whole thing got so convoluted because I figured out how to do it while breaking that rule. (And so the wheel was reinvented in the process.)
Also as a relative newcomer to the Wiki and to Oblivion scripting I might add a lot of the time when I'm searching for information here I find the answers in articles that are very obscure to what I was looking for. And also that articles and tutorials tend to be written for people who already know something about modding. I try to write as 101 as possible when I explain things because I know what it's like to show up completely ignorant. :D --Bruneauinfo 08:44, 24 December 2010 (EST)
Indeed. Actually, let me take this opportunity to thank you for that - I have been literally begging people who are new to modding to report what is confusing them on the Wiki for years, and you are... just about the first to do it.
Dragoon Wraith TALK 13:36, 24 December 2010 (EST)