Difference between revisions of "FormList Pseudocode"
Jump to navigation
Jump to search
m (Add link to FormList Script) |
(Add note about FO4) |
||
Line 1: | Line 1: | ||
Pseudocode for the [[FormList Script|FormList's Papyrus functions]] by [https://www.nexusmods.com/users/3027732 Glitchfinder], uploaded at their request.<syntaxhighlight lang="c++"> | Pseudocode for the [[FormList Script|FormList's Papyrus functions]] by [https://www.nexusmods.com/users/3027732 Glitchfinder], uploaded at their request. | ||
Note that all testing for these was done on Fallout 4; and though we have no reason to believe the engines differ, it still is a different engine, and therefore this pseudocode may or may not accurately reflect any oddities in the engine. That said, we could theorize no reason for Bethesda to change this between games.<syntaxhighlight lang="c++"> | |||
class FormList | class FormList | ||
Latest revision as of 04:53, 8 March 2022
Pseudocode for the FormList's Papyrus functions by Glitchfinder, uploaded at their request.
Note that all testing for these was done on Fallout 4; and though we have no reason to believe the engines differ, it still is a different engine, and therefore this pseudocode may or may not accurately reflect any oddities in the engine. That said, we could theorize no reason for Bethesda to change this between games.
class FormList
OrderedList scriptForms;
OrderedList pluginForms;
FormList(OrderedList plugin) {
scriptForms = new OrderedList();
pluginForms = plugin;
}
void AddForm(Form newForm) {
if (scriptForms.Contains(newForm))
return;
scriptForms.Append(newForm);
}
int Find(Form findForm) {
if (scriptForms.Contains(findForm))
return scriptForms.IndexOf(findForm);
if (pluginForms.Contains(findForm))
return scriptForms.Length + pluginForms.IndexOf(findForm);
return -1;
}
Form GetAt(int formIndex) {
if (scriptForms.Length > formIndex)
return scriptForms[formIndex];
formIndex -= scriptForms.Length;
if (pluginForms.Length > formIndex)
return pluginForms[formIndex];
return None;
}
int GetSize() {
// Untested, therefore, an assumption
return scriptForms.Length + pluginForms.Length;
}
bool HasForm(Form testForm) {
if (scriptForms.Contains(testForm))
return true;
return pluginForms.Contains(testForm);
}
void RemoveAddedForm(Form removeForm) {
scriptForms.Remove(removeForm);
}
void Revert() {
scriptForms.Clear()
}
}