AccessGetSet Variables Between Mods?

Post » Mon Nov 19, 2012 1:51 pm

Is it possible to get/set variables between different mods (not scripts, mods)?

I tried making two mods, creating an identical global in each mod and then creating a Quest script in each mod that will change the global. When I tested it in game, there were two separate globals (even though they are named the same). Each quest script only changes the global from it's own mod.

When I try to set the global via console, I can only set one of the two identical globals. The other, does not update.

Any ideas??
User avatar
Avril Churchill
 
Posts: 3455
Joined: Wed Aug 09, 2006 10:00 am

Post » Mon Nov 19, 2012 9:46 am

Creating two identical globals would make those two mod files incompatable I think. You'd need to make one mod a master of the other, then you could simply have one global and it could be set in either of the mods via script.
User avatar
Matt Terry
 
Posts: 3453
Joined: Sun May 13, 2007 10:58 am

Post » Mon Nov 19, 2012 7:32 pm

It's possible to directly edit property variables in another's mod's scripts. I'm in a hurry right now so don't have time to explain, but it's possible.
User avatar
glot
 
Posts: 3297
Joined: Mon Jul 17, 2006 1:41 pm

Post » Mon Nov 19, 2012 8:52 pm

Creating two identical globals would make those two mod files incompatable I think. You'd need to make one mod a master of the other, then you could simply have one global and it could be set in either of the mods via script.
Hey AJ! Hmm, I would rather not have to use a master file since I want the mods to be completely independent of each other e.g. you can use either without the other.
It's possible to directly edit property variables in another's mod's scripts. I'm in a hurry right now so don't have time to explain, but it's possible.
Thanks Maegfaer, perhaps you can enlighten me when you get the chance. Also, is your method possible to do without dependencies?
User avatar
Chris Guerin
 
Posts: 3395
Joined: Thu May 10, 2007 2:44 pm

Post » Mon Nov 19, 2012 9:29 pm

You can access forms from another pluggin with the http://www.creationkit.com/GetFormFromFile_-_Gamefunction. Which must be what Maegfaer was talking about.
User avatar
Jonny
 
Posts: 3508
Joined: Wed Jul 18, 2007 9:04 am

Post » Mon Nov 19, 2012 10:46 pm

Yup. GetFormFromFile can do this easily.

GlobalVariable kOtherModGLOB = Game.GetFormFromFile(0x00000800, "OtherMod.esp") As GlobalVariablekOtherModGLOB.SetValue(1.0)
Identically named GLOB forms in multiple plugins won't cause a problem in game as their FormIDs will be different unless they're both injecting the form into a common master which is not as clean. Only if both plugins were opened in the Editor would there be a complaint about their EditorIDs being the same.
User avatar
Chris Duncan
 
Posts: 3471
Joined: Sun Jun 24, 2007 2:31 am

Post » Mon Nov 19, 2012 6:01 pm

Ah, I remember having a this conversation about that function when i wanted to see if you could detect whether a user had another mod installed. This function is great!

Thank you very much JustinOther and amgepo :D
User avatar
helen buchan
 
Posts: 3464
Joined: Wed Sep 13, 2006 7:17 am


Return to V - Skyrim