GetFormFromFile() is broken. What the heck?

Post » Thu Apr 17, 2014 9:09 am

GlobalVariable Property dubhIsDLC1PluginLoaded AutoGlobalVariable Property dubhIsDLC2PluginLoaded AutoEvent OnInit()	Bool bIsDLC1PluginLoaded   = Game.GetFormFromFile(0x00FF0000, "TheyWontEvenKnow - Dawnguard.esp")	Bool bIsDLC2PluginLoaded   = Game.GetFormFromFile(0x00FF0000, "TheyWontEvenKnow - Dragonborn.esp")	If bIsDLC1PluginLoaded == True		Debug.Trace("fireundubh: Dawnguard plugin is loaded.")		dubhIsDLC1PluginLoaded.SetValueInt(1)	Else		Debug.Trace("fireundubh: Dawnguard plugin is not loaded.")	EndIf	If bIsDLC2PluginLoaded == True		Debug.Trace("fireundubh: Dragonborn plugin is loaded.")		dubhIsDLC2PluginLoaded.SetValueInt(1)	Else		Debug.Trace("fireundubh: Dragonborn plugin is not loaded.")	EndIf	RegisterForSingleUpdate(2.5)	GoToState("Active")EndEvent

For some reason, GetFormFromFile() isn't returning True when those plugins are active. What's wrong?
User avatar
Meghan Terry
 
Posts: 3414
Joined: Sun Aug 12, 2007 11:53 am

Post » Thu Apr 17, 2014 11:31 am

You might have to type cast the returned values as booleans:

Bool bIsDLC1PluginLoaded = Game.GetFormFromFile(0x00FF0000, "TheyWontEvenKnow - Dawnguard.esp") as BoolBool bIsDLC2PluginLoaded = Game.GetFormFromFile(0x00FF0000, "TheyWontEvenKnow - Dragonborn.esp") as Bool

Alternatively set the variable types to Form and check if the variables are None. The function returns a value of the type Form so you either need to type cast or assign the returned value to a variable with the same type (Form in this case).

User avatar
Hannah Whitlock
 
Posts: 3485
Joined: Sat Oct 07, 2006 12:21 am

Post » Thu Apr 17, 2014 12:55 pm


I tried both per your suggestions. No change.

They're both returning None.
User avatar
Setal Vara
 
Posts: 3390
Joined: Thu Nov 16, 2006 1:24 pm

Post » Thu Apr 17, 2014 10:54 am

Okay, I think I fixed it.

GetFormFromFile() was returning None.

0x00FF0000 referred to records that overrided a record in the main file.

I changed the Form IDs to records that are unique to the plugins.

The trace statements then indicated that the plugins were loaded.
User avatar
Catherine Harte
 
Posts: 3379
Joined: Sat Aug 26, 2006 12:58 pm

Post » Thu Apr 17, 2014 11:50 am

I was just about to post that the FormIDs seemed a bit odd before you posted. The index (first two digits of the FormID, in this case the double zeros after 0x) should have been 01 or higher if the plugins had one or more masters.

User avatar
Elizabeth Falvey
 
Posts: 3347
Joined: Fri Oct 26, 2007 1:37 am

Post » Thu Apr 17, 2014 12:52 am

Thanks for helping me troubleshoot.

I had this problem with another mod. With that mod, I was just getting a custom game setting from Requiem, so I decided to forgo GetFormFromFile() and discovered that Skyrim doesn't throw a fit if you try to get a game setting that doesn't exist without, for example, Requiem installed.

But I couldn't do that here.
User avatar
Heather Kush
 
Posts: 3456
Joined: Tue Jun 05, 2007 10:05 pm


Return to V - Skyrim