Difference between revisions of "Talk:GetFormFromFile - Game"
imported>JustinOther |
imported>JustinOther m (Reverted edits by JustinOther (talk) to last revision by Cipscis) |
||
Line 10: | Line 10: | ||
Of course, even that might not work if the mod creator had deleted the very first object he/she created in the mod. | Of course, even that might not work if the mod creator had deleted the very first object he/she created in the mod. | ||
--[[User:Fg109|Fg109]] 01:37, 27 June 2012 (EDT) | --[[User:Fg109|Fg109]] 01:37, 27 June 2012 (EDT) | ||
== Appropriate Use == | == Appropriate Use == | ||
Line 24: | Line 19: | ||
Is anyone able to think of any other ways in which this function could be used that couldn't be replicated with Properties alone without downsides? At the moment, just like I feel all use of [[GetForm_-_Game|GetForm]] should be discouraged, I feel as though all use of this function aside from the one I mentioned above should also be discouraged. | Is anyone able to think of any other ways in which this function could be used that couldn't be replicated with Properties alone without downsides? At the moment, just like I feel all use of [[GetForm_-_Game|GetForm]] should be discouraged, I feel as though all use of this function aside from the one I mentioned above should also be discouraged. | ||
--[[User:Cipscis|Cipscis]] ([[User talk:Cipscis|talk]]) 23:14, 21 August 2012 (EDT) | -- [[User:Cipscis|Cipscis]] ([[User talk:Cipscis|talk]]) 23:14, 21 August 2012 (EDT) | ||
Revision as of 23:47, 23 August 2012
GetModLoaded
In the example on the page, the form ID 0x800 is used to test whether or not a mod is loaded. In my experience, a mod's first form has form ID 0x800 only if you're creating it without having loaded any masters.
If any other files have been loaded, then the form ID is usually 0xD62. Perhaps it would be better to re-write the example as
If bDLCArray[aiIndex] != (Game.GetFormFromFile(0x00000800, sDLCArray[aiIndex]) \
|| (Game.GetFormFromFile(0x00000D62, sDLCArray[aiIndex]))
Of course, even that might not work if the mod creator had deleted the very first object he/she created in the mod. --Fg109 01:37, 27 June 2012 (EDT)
Appropriate Use
Since I first started scripting with Papyrus, I've tried to treat "Keep the script blind to information in the data files" as a rule, or at least best practice, exclusively using Properties as the script's interface with data files and avoiding the use of functions such as GetForm. To date, I have seen no good reason to change this behaviour.
While at first glance it seems as though this rule should also lead me to entirely neglect this function, I can see one legitimate use for it: Enabling compatibility with mods without setting them as masters. The advantage of this is that only a single data file is required for any combination of loaded mods that would otherwise have been masters, and I expect it also decreases dependency on load order.
Is anyone able to think of any other ways in which this function could be used that couldn't be replicated with Properties alone without downsides? At the moment, just like I feel all use of GetForm should be discouraged, I feel as though all use of this function aside from the one I mentioned above should also be discouraged.