Difference between revisions of "GetFormFromFile - Game"

Jump to navigation Jump to search
17 bytes added ,  22:36, 26 June 2012
m
→‎Examples: 0x00000800 FormID will probably exist as a new plugin's NOID dictates
imported>JustinOther
m (→‎Examples: Grrr! I'd pasted over the properties >_<)
imported>JustinOther
m (→‎Examples: 0x00000800 FormID will probably exist as a new plugin's NOID dictates)
Line 31: Line 31:
*To merely detect if a plugin is loaded.
*To merely detect if a plugin is loaded.
<source lang="papyrus">Bool bIsBagOfHoldingLoaded = Game.GetFormFromFile(0x000012EE, "Bag of Holding.esp") ; Is Bag of Holding.esp loaded?</source>
<source lang="papyrus">Bool bIsBagOfHoldingLoaded = Game.GetFormFromFile(0x000012EE, "Bag of Holding.esp") ; Is Bag of Holding.esp loaded?</source>
*Say you want to detect if DLCs are loaded and need to do/undo something in the event a DLC is added or removed from the user's load list: Create a boolean and string array, each with one element per DLC to check. When setting up the properties, leave the boolean elements with their default 'False' values and set each string element with the exact name of the plugin to check for such that their indices correspond. For this to work, the '000000' instances must be changed to match a known existing FormID in each plugin.
*Say you want to detect if DLCs are loaded and need to do/undo something in the event a DLC is added or removed from the user's load list: Create a boolean and string array, each with one element per DLC to check. When setting up the properties, leave the boolean elements with their default 'False' values and set each string element with the exact name of the plugin to check for such that their indices correspond. For this to work, the '0x00000800' instances ''might'' need to be changed to match a known existing FormID in each plugin.
<source lang="papyrus">Bool[] Property bDLCArray Auto
<source lang="papyrus">Bool[] Property bDLCArray Auto
String[] Property sDLCArray Auto
String[] Property sDLCArray Auto
Line 40: Line 40:
aiIndex -= 1
aiIndex -= 1
If aiIndex == 0 ; Dawnguard.ESM
If aiIndex == 0 ; Dawnguard.ESM
If bDLCArray[aiIndex] != Game.GetFormFromFile(0x00000000, sDLCArray[aiIndex])
If bDLCArray[aiIndex] != Game.GetFormFromFile(0x00000800, sDLCArray[aiIndex])
bDLCArray[aiIndex] = !bDLCArray[aiIndex]
bDLCArray[aiIndex] = !bDLCArray[aiIndex]
If bDLCArray[aiIndex]
If bDLCArray[aiIndex]
Line 49: Line 49:
EndIf
EndIf
ElseIf aiIndex == 1 ; Hearthfire.ESM
ElseIf aiIndex == 1 ; Hearthfire.ESM
If bDLCArray[aiIndex] != Game.GetFormFromFile(0x00000000, sDLCArray[aiIndex])
If bDLCArray[aiIndex] != Game.GetFormFromFile(0x00000800, sDLCArray[aiIndex])
bDLCArray[aiIndex] = !bDLCArray[aiIndex]
bDLCArray[aiIndex] = !bDLCArray[aiIndex]
If bDLCArray[aiIndex]
If bDLCArray[aiIndex]
Anonymous user

Navigation menu