Jump to content

Do RefIDs Need to Be Unique Across Different Mods?


user826

Recommended Posts

Thanks for the explanation. The scripting language that Oblivion, FO3, and FNV use is different from the languages I have learned (Assembler, C, C++, and Java) as well as the basic concepts of OOP. I just never knew that anyone had tried to standardize the terminology between the text IDs we give objects and can assign to references and the hex-ID the GECK assigns to them.

Link to comment
Share on other sites

You don't have to use Reference Editor IDs (the names) at all.

If you open up the Render Window and click on the object of interest, aside of the Reference Editor ID text field you'll find the actual RefID in brakes.

Note down the ID. Let's say your object has the ID 030294CD (I've made that one up on the spot! Don't use it).

Depending on your load order, this object might be something from a DLC (as of the 03 at the start), or from a mod if you don't use the Ultimate Edition of New Vegas.

 

Now lets look on a script where you might need to change something about the object of interest:

ref YourObjectOfInterestReference
 
Begin MenuMode 4 ;=> This only works when you have JIP LN NVSE plugin. It will run in the main menu of the game.
   if YourObjectOfInterestReference == 0
      Let YourObjectOfInterestReference := GetFormFromMod "Plugin Name.esp or Main Name.esm" "294CD" ;=> You don't need the zeros in front,' only the correct ESP or ESM name.
   endif
;=> Now the reference variable is set and you can work with it. If this is a quest script,
;=> you can call for that variable from everywhere by using "Questname.YourObjectOfInterestReference"
End

To make it a bit clearer, let's say the ID is from the Honest Hearts DLC (don't know if that one loads at 03).

So...

Let YourObjectOfInterestReference := GetFormFromMod "Honest Hearts.esm" "294CD"

Be aware, that you need JIP LN NVSE plugin (it's Lutana legacy :D) for "GetFormFromMod".

 

You can now use "YourObjectOfInterestReference" for Enable or Disable or SetPos commands, whatever.

It will work on the world space reference without actually using a Reference Editor ID (a name) for the reference.

 

 

 

I even needed to do this on my farmhouse update.

Plants have an issue. When you make a persist reference out of them for being able to use a Reference Editor ID, the regrowing is somehow broken.

Everytime you enter an interior und leave to the exterior where the plants are planted, they are regrown.

I avoided that issue, by not making them a persistent reference (speaking of that checkbox you need to tick in the world object window) and didn't give it a name.

Instead, I used GetFormFromMod to build ref variables making me able to interact with the plants in scripts, but without breaking them by making them a persistent reference.

Now they need the regular 3 day cycle to regrow.

Link to comment
Share on other sites

You don't have to use Reference Editor IDs (the names) at all. ....

 

I know all that. The first post made me think the OP was a noob that didn't understand scripting or how the game works with those IDs. DubiouisIntent, knowing the OP personally, was able to understand the context of their post and what they were asking.

 

It goes to show how important it is to know how to ask a public question, versus how you would ask someone you already know well in a PM.

 

I am going to butt-out of this topic now...

Edited by GamerRick
Link to comment
Share on other sites

For every person asking a question there are dozens (at least) who are interested but don't "butt-in". (For example: this thread has over 100 views at this point but only 4 active participants.) And it is incredibly easy to misread or misinterpret a question. Different viewpoints help to clarify and refine the situation. And often that discussion brings out things that are related but may not have been intended in the original asking.

 

And GamerRick: I don't know the OP personally, but usually try not to make any assumptions are how technically proficient someone may be until I have developed some experience with them. So I usually try to explain as if they are novices until proven otherwise. (Some very good scripters don't have formal "Computer Science" backgrounds.) And even professional programmers have some "blind spots" simply because of where their experience lies. (I know I certainly do.) You offered valid alternative considerations, and I welcomed your contributions (and those of the others.)

 

Feel free to "butt-in" anytime.

 

-Dubious-

Link to comment
Share on other sites

Oops. I reread the first 4 posts and realized I misread the question and what User826 was trying to do. Sorry about that. :facepalm:

 

The question I have is: Since the GECK compiles the script with info it has, and sets the External Global References in the script to a specific hex ID, if another mod uses the same text Reference-Editor-ID (or reference variable), and then compiles their script(s), won't the global reference in the script get resolved to their hex-ID?

 

I think a scripting language has several levels of "compile". First it gets compiled by the GECK into an intermediate condensed bit-code, and at runtime it gets compiled by the game engine into machine code.

 

Looking at a mod's script in FNVEdit, it looks like the text Ref-ID and hex-ID are there as external global references to be resolved at runtime.

 

So, I don't know what the game engine would do when compiling the script into machine code. Would another mod with the same text Reference-editor-ID confuse it?

Edited by GamerRick
Link to comment
Share on other sites

That is a very good question, and I think only someone who has gotten deep into the game internals like the NVSE and JIP LN teams can definitively answer it.

 

However, my working hypothesis (based upon the apparent design of "text IDs are just for the numerically memory challenged humans") is: that is why the compiler uses it's own naming mechanism instead of that of the script writer. The external global references are (presumably) based upon record numbers, and that is what makes them unique between plugins. The "Script" record variable "SLSD - Local Variable Data" is based upon it's "index value" (presumably within an array of variables specific to that script) with the "text name" stored as "SCVR - Name" data. (Which supports the idea that the text label is only for the benefit of humans. I doubt they are used by the engine at all except for display purposes.) Each "script record" is still unique across plugins, even though the text "Editor ID" might still be the same; it's irrelevant data only of interest to humans. That the "Editor ID" might be for a "Reference" doesn't matter. "Mod Index" is what gives context to the referenced record.

 

At least: that is my take on the matter. Could be wrong, but close enough to go on with until proven otherwise. (AND why I said the thread title was misleading and asking the wrong question. AND I hadn't thought this all out until this thought provoking discussion. So hopefully we all haven't learned the wrong lesson.)

 

-Dubious-

Link to comment
Share on other sites

OK Tested. DoiubiousIntent is correct in his assumptions. I tried both giving another object the same Ref-var and having the second mod remove both the Ref-var and the persistent setting of the object that the first mod sets persistent and gives a ref-var.. The first mod still had no problem doing its thing.

 

It even worked when the 2nd esp was made dependent on the 1st.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...