FormList Pseudocode
Jump to navigation
Jump to search
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()
}
}