I have an example of script below which assembles with no errors but doesn't work
I am missing something but I want to test if dawnguard is installed. What do I need to modify to make this work ?
Bool[] Property bDLCIsLoaded Auto ; Element 0 is bDawnguard, etc. Int[] Property iKnownFormID Auto ; Element 0 is 2048 for Dawnguard's DLC1AurielsBow "Auriel's Bow" [WEAP:02000800], etc. String[] Property sDLCName Auto ; Element 0 is Dawnguard.ESM, Element 1 is HearthFires.ESM, element 2 is Dragonborn.ESM, etc.
Function CheckForDLC()
Int iIndex = sDLCName.Length
While iIndex
iIndex -= 1
If bDLCIsLoaded[iIndex] != Game.GetFormFromFile(iKnownFormID[iIndex], sDLCName[iIndex])
bDLCIsLoaded[iIndex] = !bDLCIsLoaded[iIndex]
If bDLCIsLoaded[iIndex]
Debug.Trace(sDLCName[iIndex] + " is loaded")
If iIndex == 0 ; Dawnguard
; Make any changes needed for Dawnguard
ElseIf iIndex == 1 ; Hearthfire
; Make any changes needed for Hearthfire
ElseIf iIndex == 2 ; Dragonborn
; Make any changes needed for Dragonborn
EndIf
Else
Debug.Trace(sDLCName[iIndex] + " was loaded, but is no longer")
If iIndex == 0 ; Dawnguard
; Revert any changes previously made for Dawnguard
ElseIf iIndex == 1 ; Hearthfire
; Revert any changes previously made for Hearthfire
ElseIf iIndex == 2 ; Dragonborn
; Revert any changes previously made for Dragonborn
EndIf
EndIf
EndIf
EndWhile EndFunction