Checking a "non exisent" variable

Post » Wed Mar 02, 2011 3:05 am

For a Mod I'm working on, I want to be able to check a Mod which the Player MAY have Installed, but does not HAVE to-- I want to check a specific Variable related with this Mod, but don't want to have it as a Master-- but of course, the CS won't allow you to save a Script with an unknown Variable, so is there a way I can actually do this?

I figured I could just load the two Mods into the CS at once, with one inactive, but I'm guessing it will suffer from the "Can't use other .esp file data" issue...
User avatar
Darian Ennels
 
Posts: 3406
Joined: Mon Aug 20, 2007 2:00 pm

Post » Tue Mar 01, 2011 8:23 pm

De-isolation in general is described http://cs.elderscrolls.com/constwiki/index.php/De-Isolation_Tutorial and I think I've used script variables that way.
User avatar
Tasha Clifford
 
Posts: 3295
Joined: Fri Jul 21, 2006 7:08 am

Post » Wed Mar 02, 2011 9:19 am

De-isolation, and esmifying the other mod in order to load it as a master with your mod will work, but that makes the other mod a master for your mod, and that seems to not be what you want, as that would crash Oblivion if you try to start it with your mod loaded and without the other mod.

So you have two choices, either making two versions of your mod, one standalone and one with the other mod as a master, or - much better - turn to OBSE. OBSE has a number of great, easy-to-use cross-mod functions. The most important are:

IsModLoaded "" - returns true if is loaded.
set myRef to GetFormFromMod "" "" - sets your local ref variable to refer to an object defined in another mod. The ref variable can then be used just like any other.
RunScriptLine "<scriptline>" - runs one script line that don't need to be valid in the CS, just as if you opened the console ingame and wrote the text. For example:
RunScriptLine "set myQuest.myVar to questFromOtherMod.otherVar" will set your local "myVar" variable to the value of the quest variable in another mod.
User avatar
Maeva
 
Posts: 3349
Joined: Mon Mar 26, 2007 11:27 pm

Post » Tue Mar 01, 2011 9:37 pm

Thanks, that sounds helpful-- and deisolation was useful, too, for something else :)

One quick check, does IsModLoaded need the .esp extension? I assume so, but since it's checking for Mods anyway...
User avatar
MARLON JOHNSON
 
Posts: 3377
Joined: Sun May 20, 2007 7:12 pm

Post » Wed Mar 02, 2011 8:40 am

Yes, .esp/.esm extension required.

If you're checking for a global variable you can use GlobalVariableExists "varname".
User avatar
josie treuberg
 
Posts: 3572
Joined: Wed Feb 07, 2007 7:56 am


Return to IV - Oblivion