UNPKG

@skyrim-platform/papyrus-util

Version:

TypeScript library for the PapyrusUtil Skyrim modding utility

738 lines (682 loc) 49.3 kB
/* ============================================== Typescript definitions for v4.2 ============================================== This file was automatically generated by Papyrus-2-Typescript.exe https://github.com/CarlosLeyvaAyala/Papyrus-2-Typescript The program has no way to know the intention of the humans that made the scripts, so it's always advisable to manually check all generated files to make sure everything is declared as it should. Take note the program assumes this script exists in some subfolder to the folder where `skyrimPlatform.ts` is found, otherwise you'll get "Cannot find module..." type of errors. If you want to have this script in some other place, just change the relative path of each `import`. */ import * as sp from "skyrimPlatform"; var sn = sp.StorageUtil; /** MOD AUTHORS, READ! This script contains functions for saving and loading any amount of int, float, form and string values by name on a form or globally. These values can be accessed and changed from any mod which allows mods to become compatible with each other without adding any requirements to the other mod or its version other than this plugin. Values will stay on forms or globally until they are Unset or Cleared in case of lists. If value is set on a form and the object is deleted then THE value will be removed when saving game. If you are done with using a certain variable you should use Unset or Clear function to remove them but it is not required. Saving MCM config values here would allow other mods to change your mod settings which may be useful. It should also allow you to change MCM config script without worrying about versioning since there are no new variables in the script itself. Functions that start with File in the name will save values to a separate file, so that you can access the same values from all savegames. This may be useful for configuration settings. (FILE FUNCTIONS ARE DEPRECATED! USE JSONUTIL.PSC INSTEAD) Saved values take very little memory - expect to use less than 500 KB of physical memory even when setting thousands of values. Value names are not case sensitive, that means GetIntValue(none, "abc") == GetIntValue(none, "aBC"). All values are separated from each other by type! That means SetIntValue(none, "abc", 1) and SetFloatValue(none, "abc", 2.0) create separate entries and aren't affected by each other. StorageUtil.SetIntValue(none, "myValue", 1) StorageUtil.SetFloatValue(none, "myValue", 5.0) int value = StorageUtil.GetIntValue(none, "myValue") value == 1 ; true value == 5 ; false When choosing names for variables try to remember that all mods access the same storage, so if you create a variable with name "Name" then many other mods could use the same variable but in different ways that lead to unwanted behavior. It is recommended to prefix the variable with your mod name, that way you can be sure nobody else will try to use the same variable in their mod. For example realistic needs and diseases might set hunger as "rnd_hungervalue". You can also use this storage to make your mod functions available to other mods, for example if your mod has a function that sets an Actor to be invisible you could add a script that checks: int i = StorageUtil.FormListCount(none, "MakeInvisible") while(i > 0) i-- Actor make = StorageUtil.FormListGet(none, "MakeInvisible", i) as Actor if(make) MyScriptFunction(make) endif StorageUtil.FormListRemoveAt(none, "MakeInvisible", i) endwhile And the other mod could write: StorageUtil.FormListAdd(none, "MakeInvisible", myActor) to make someone invisible using your mod. But if your mod isn't present then nothing happens. This is just an example, I'm sure you can find better ways to implement compatibility, it would help to include a documentation for other modders if you do. /** /** Storage functions - values in save game file. */ /** Set int/float/string/Form value globally or on any form by name and return the value passed, or as uninitialized variable if invalid keys given. ObjKey: form to save on. Set none to save globally. KeyName: name of value. value: value to set to the given keys. If zero, empty, or none are given, the key will be unset. */ export var SetIntValue = function (ObjKey, KeyName, value) { return sn.SetIntValue(ObjKey, KeyName, value); }; export var SetFloatValue = function (ObjKey, KeyName, value) { return sn.SetFloatValue(ObjKey, KeyName, value); }; export var SetStringValue = function (ObjKey, KeyName, value) { return sn.SetStringValue(ObjKey, KeyName, value); }; export var SetFormValue = function (ObjKey, KeyName, value) { return sn.SetFormValue(ObjKey, KeyName, value); }; /** Remove a previously set int/float/string/Form value on an form or globally and if successful. This will return false if value didn't exist. ObjKey: form to remove from. Set none to remove global value. KeyName: name of value. */ export var UnsetIntValue = function (ObjKey, KeyName) { return sn.UnsetIntValue(ObjKey, KeyName); }; export var UnsetFloatValue = function (ObjKey, KeyName) { return sn.UnsetFloatValue(ObjKey, KeyName); }; export var UnsetStringValue = function (ObjKey, KeyName) { return sn.UnsetStringValue(ObjKey, KeyName); }; export var UnsetFormValue = function (ObjKey, KeyName) { return sn.UnsetFormValue(ObjKey, KeyName); }; /** Check if int/float/string/Form value has been set on form or globally. ObjKey: form to check on. Set none to check global value. KeyName: name of value. */ export var HasIntValue = function (ObjKey, KeyName) { return sn.HasIntValue(ObjKey, KeyName); }; export var HasFloatValue = function (ObjKey, KeyName) { return sn.HasFloatValue(ObjKey, KeyName); }; export var HasStringValue = function (ObjKey, KeyName) { return sn.HasStringValue(ObjKey, KeyName); }; export var HasFormValue = function (ObjKey, KeyName) { return sn.HasFormValue(ObjKey, KeyName); }; /** Get previously saved int/float/string/Form value on form or globally. ObjKey: form to get from. Set none to get global value. KeyName: name of value. [optional] missing: if value has not been set, return this value instead. */ export var GetIntValue = function (ObjKey, KeyName, missing) { if (missing === void 0) { missing = 0; } return sn.GetIntValue(ObjKey, KeyName, missing); }; export var GetFloatValue = function (ObjKey, KeyName, missing) { if (missing === void 0) { missing = 0.0; } return sn.GetFloatValue(ObjKey, KeyName, missing); }; export var GetStringValue = function (ObjKey, KeyName, missing) { if (missing === void 0) { missing = ""; } return sn.GetStringValue(ObjKey, KeyName, missing); }; export var GetFormValue = function (ObjKey, KeyName, missing) { if (missing === void 0) { missing = null; } return sn.GetFormValue(ObjKey, KeyName, missing); }; /** Plucks a previously saved int/float/string/Form value on form or globally. Returning the value stored, then removing it from storage. ObjKey: form to pluck from. Set none to get global value. KeyName: name of value. [optional] missing: if value has not been set, return this value instead. */ export var PluckIntValue = function (ObjKey, KeyName, missing) { if (missing === void 0) { missing = 0; } return sn.PluckIntValue(ObjKey, KeyName, missing); }; export var PluckFloatValue = function (ObjKey, KeyName, missing) { if (missing === void 0) { missing = 0.0; } return sn.PluckFloatValue(ObjKey, KeyName, missing); }; export var PluckStringValue = function (ObjKey, KeyName, missing) { if (missing === void 0) { missing = ""; } return sn.PluckStringValue(ObjKey, KeyName, missing); }; export var PluckFormValue = function (ObjKey, KeyName, missing) { if (missing === void 0) { missing = null; } return sn.PluckFormValue(ObjKey, KeyName, missing); }; /** Get previously saved int/float/string/Form value on form or globally. ObjKey: form to get from. Set none to get global value. KeyName: name of value. amount: +/- the amount to adjust the current value by given keys will be initialized to given amount if it does not exist */ export var AdjustIntValue = function (ObjKey, KeyName, amount) { return sn.AdjustIntValue(ObjKey, KeyName, amount); }; export var AdjustFloatValue = function (ObjKey, KeyName, amount) { return sn.AdjustFloatValue(ObjKey, KeyName, amount); }; /** Add an int/float/string/Form to a list on form or globally and return the value's new index. Index can be -1 if we were unable to add the value. ObjKey: form to add to. Set none to add global value. KeyName: name of value. value: value to add. [optional] allowDuplicate: allow adding value to list if this value already exists in the list. */ export var IntListAdd = function (ObjKey, KeyName, value, allowDuplicate) { if (allowDuplicate === void 0) { allowDuplicate = true; } return sn.IntListAdd(ObjKey, KeyName, value, allowDuplicate); }; export var FloatListAdd = function (ObjKey, KeyName, value, allowDuplicate) { if (allowDuplicate === void 0) { allowDuplicate = true; } return sn.FloatListAdd(ObjKey, KeyName, value, allowDuplicate); }; export var StringListAdd = function (ObjKey, KeyName, value, allowDuplicate) { if (allowDuplicate === void 0) { allowDuplicate = true; } return sn.StringListAdd(ObjKey, KeyName, value, allowDuplicate); }; export var FormListAdd = function (ObjKey, KeyName, value, allowDuplicate) { if (allowDuplicate === void 0) { allowDuplicate = true; } return sn.FormListAdd(ObjKey, KeyName, value, allowDuplicate); }; /** Get a value from list by index on form or globally. This will return 0 as value if there was a problem. ObjKey: form to get value on. Set none to get global list value. KeyName: name of list. index: index of value in the list. */ export var IntListGet = function (ObjKey, KeyName, index) { return sn.IntListGet(ObjKey, KeyName, index); }; export var FloatListGet = function (ObjKey, KeyName, index) { return sn.FloatListGet(ObjKey, KeyName, index); }; export var StringListGet = function (ObjKey, KeyName, index) { return sn.StringListGet(ObjKey, KeyName, index); }; export var FormListGet = function (ObjKey, KeyName, index) { return sn.FormListGet(ObjKey, KeyName, index); }; /** Set a value in list by index on form or globally. This will return the previous value or 0 if there was a problem. ObjKey: form to set value on. Set none to set global list value. KeyName: name of list. index: index of value in the list. value: value to set to. */ export var IntListSet = function (ObjKey, KeyName, index, value) { return sn.IntListSet(ObjKey, KeyName, index, value); }; export var FloatListSet = function (ObjKey, KeyName, index, value) { return sn.FloatListSet(ObjKey, KeyName, index, value); }; export var StringListSet = function (ObjKey, KeyName, index, value) { return sn.StringListSet(ObjKey, KeyName, index, value); }; export var FormListSet = function (ObjKey, KeyName, index, value) { return sn.FormListSet(ObjKey, KeyName, index, value); }; /** Plucks a value from list by index on form or globally. The index is removed from the list's storage after returning it's value. ObjKey: form to pluck value from. Set none to get global list value. KeyName: name of list. index: index of value in the list. [optional] missing: if index has not been set, return this value instead. */ export var IntListPluck = function (ObjKey, KeyName, index, missing) { return sn.IntListPluck(ObjKey, KeyName, index, missing); }; export var FloatListPluck = function (ObjKey, KeyName, index, missing) { return sn.FloatListPluck(ObjKey, KeyName, index, missing); }; export var StringListPluck = function (ObjKey, KeyName, index, missing) { return sn.StringListPluck(ObjKey, KeyName, index, missing); }; export var FormListPluck = function (ObjKey, KeyName, index, missing) { return sn.FormListPluck(ObjKey, KeyName, index, missing); }; /** Gets the value of the very first element in a list, and subsequently removes the index afterward. ObjKey: form to shift value from. Set none to get global list value. KeyName: name of list to shift it's first value from. */ export var IntListShift = function (ObjKey, KeyName) { return sn.IntListShift(ObjKey, KeyName); }; export var FloatListShift = function (ObjKey, KeyName) { return sn.FloatListShift(ObjKey, KeyName); }; export var StringListShift = function (ObjKey, KeyName) { return sn.StringListShift(ObjKey, KeyName); }; export var FormListShift = function (ObjKey, KeyName) { return sn.FormListShift(ObjKey, KeyName); }; /** Gets the value of the very last element in a list, and subsequently removes the index afterward. ObjKey: form to pop value from. Set none to get global list value. KeyName: name of list to pop off it's last value. */ export var IntListPop = function (ObjKey, KeyName) { return sn.IntListPop(ObjKey, KeyName); }; export var FloatListPop = function (ObjKey, KeyName) { return sn.FloatListPop(ObjKey, KeyName); }; export var StringListPop = function (ObjKey, KeyName) { return sn.StringListPop(ObjKey, KeyName); }; export var FormListPop = function (ObjKey, KeyName) { return sn.FormListPop(ObjKey, KeyName); }; /** Adjust the existing value of a list by the given amount. ObjKey: form to set value on. Set none to set global list value. KeyName: name of list. index: index of value in the list. amount: +/- the amount to adjust the lists current index value by. s 0 if index does not exists */ export var IntListAdjust = function (ObjKey, KeyName, index, amount) { return sn.IntListAdjust(ObjKey, KeyName, index, amount); }; export var FloatListAdjust = function (ObjKey, KeyName, index, amount) { return sn.FloatListAdjust(ObjKey, KeyName, index, amount); }; /** Insert an int/float/string/Form to a list on form or globally and return if successful. ObjKey: form to add to. Set none to add global value. KeyName: name of value. index: position in list to put the value. 0 is first entry in list. value: value to add. */ export var IntListInsert = function (ObjKey, KeyName, index, value) { return sn.IntListInsert(ObjKey, KeyName, index, value); }; export var FloatListInsert = function (ObjKey, KeyName, index, value) { return sn.FloatListInsert(ObjKey, KeyName, index, value); }; export var StringListInsert = function (ObjKey, KeyName, index, value) { return sn.StringListInsert(ObjKey, KeyName, index, value); }; export var FormListInsert = function (ObjKey, KeyName, index, value) { return sn.FormListInsert(ObjKey, KeyName, index, value); }; /** Remove a previously added int/float/string/Form value from a list on form or globally and return how many instances of this value were removed. ObjKey: form to remove from. Set none to remove global value. KeyName: name of value. value: value to remove. [optional] allowInstances: remove all instances of this value in a list. */ export var IntListRemove = function (ObjKey, KeyName, value, allInstances) { if (allInstances === void 0) { allInstances = false; } return sn.IntListRemove(ObjKey, KeyName, value, allInstances); }; export var FloatListRemove = function (ObjKey, KeyName, value, allInstances) { if (allInstances === void 0) { allInstances = false; } return sn.FloatListRemove(ObjKey, KeyName, value, allInstances); }; export var StringListRemove = function (ObjKey, KeyName, value, allInstances) { if (allInstances === void 0) { allInstances = false; } return sn.StringListRemove(ObjKey, KeyName, value, allInstances); }; export var FormListRemove = function (ObjKey, KeyName, value, allInstances) { if (allInstances === void 0) { allInstances = false; } return sn.FormListRemove(ObjKey, KeyName, value, allInstances); }; /** Clear a list of values (unset) on an form or globally and the previous size of list. ObjKey: form to clear on. Set none to clear global list. KeyName: name of list. */ export var IntListClear = function (ObjKey, KeyName) { return sn.IntListClear(ObjKey, KeyName); }; export var FloatListClear = function (ObjKey, KeyName) { return sn.FloatListClear(ObjKey, KeyName); }; export var StringListClear = function (ObjKey, KeyName) { return sn.StringListClear(ObjKey, KeyName); }; export var FormListClear = function (ObjKey, KeyName) { return sn.FormListClear(ObjKey, KeyName); }; /** Remove a value from list by index on form or globally and if we were successful in doing so. ObjKey: form to remove from. Set none to remove global value. KeyName: name of list. index: index of value in the list. */ export var IntListRemoveAt = function (ObjKey, KeyName, index) { return sn.IntListRemoveAt(ObjKey, KeyName, index); }; export var FloatListRemoveAt = function (ObjKey, KeyName, index) { return sn.FloatListRemoveAt(ObjKey, KeyName, index); }; export var StringListRemoveAt = function (ObjKey, KeyName, index) { return sn.StringListRemoveAt(ObjKey, KeyName, index); }; export var FormListRemoveAt = function (ObjKey, KeyName, index) { return sn.FormListRemoveAt(ObjKey, KeyName, index); }; /** Get size of a list on form or globally. ObjKey: form to check on. Set none to check global list. KeyName: name of list. */ export var IntListCount = function (ObjKey, KeyName) { return sn.IntListCount(ObjKey, KeyName); }; export var FloatListCount = function (ObjKey, KeyName) { return sn.FloatListCount(ObjKey, KeyName); }; export var StringListCount = function (ObjKey, KeyName) { return sn.StringListCount(ObjKey, KeyName); }; export var FormListCount = function (ObjKey, KeyName) { return sn.FormListCount(ObjKey, KeyName); }; /** Get the number of occurrences of a specific value within a list. ObjKey: form to check on. Set none to check global list. KeyName: name of list. value: value to look for. [optional] exclude: if true, function will return number of elements NOT equal to value. */ export var IntListCountValue = function (ObjKey, KeyName, value, exclude) { if (exclude === void 0) { exclude = false; } return sn.IntListCountValue(ObjKey, KeyName, value, exclude); }; export var FloatListCountValue = function (ObjKey, KeyName, value, exclude) { if (exclude === void 0) { exclude = false; } return sn.FloatListCountValue(ObjKey, KeyName, value, exclude); }; export var StringListCountValue = function (ObjKey, KeyName, value, exclude) { if (exclude === void 0) { exclude = false; } return sn.StringListCountValue(ObjKey, KeyName, value, exclude); }; export var FormListCountValue = function (ObjKey, KeyName, value, exclude) { if (exclude === void 0) { exclude = false; } return sn.FormListCountValue(ObjKey, KeyName, value, exclude); }; /** Find a value in list on form or globally and return its index or -1 if value was not found. ObjKey: form to find value on. Set none to find global list value. KeyName: name of list. value: value to search. */ export var IntListFind = function (ObjKey, KeyName, value) { return sn.IntListFind(ObjKey, KeyName, value); }; export var FloatListFind = function (ObjKey, KeyName, value) { return sn.FloatListFind(ObjKey, KeyName, value); }; export var StringListFind = function (ObjKey, KeyName, value) { return sn.StringListFind(ObjKey, KeyName, value); }; export var FormListFind = function (ObjKey, KeyName, value) { return sn.FormListFind(ObjKey, KeyName, value); }; /** Find if a value in list on form or globally exists, true if it exists, false if it doesn't. ObjKey: form to find value on. Set none to find global list value. KeyName: name of list. value: value to search. */ export var IntListHas = function (ObjKey, KeyName, value) { return sn.IntListHas(ObjKey, KeyName, value); }; export var FloatListHas = function (ObjKey, KeyName, value) { return sn.FloatListHas(ObjKey, KeyName, value); }; export var StringListHas = function (ObjKey, KeyName, value) { return sn.StringListHas(ObjKey, KeyName, value); }; export var FormListHas = function (ObjKey, KeyName, value) { return sn.FormListHas(ObjKey, KeyName, value); }; /** Sort an int/float/string/Form list by values in ascending order. ObjKey: form to sort on. Set none for global value. KeyName: name of value. */ export var IntListSort = function (ObjKey, KeyName) { return sn.IntListSort(ObjKey, KeyName); }; export var FloatListSort = function (ObjKey, KeyName) { return sn.FloatListSort(ObjKey, KeyName); }; export var StringListSort = function (ObjKey, KeyName) { return sn.StringListSort(ObjKey, KeyName); }; export var FormListSort = function (ObjKey, KeyName) { return sn.FormListSort(ObjKey, KeyName); }; /** Fills the given input array with the values of the list on form or globally, will fill the array until either the array or list runs out of valid indexes ObjKey: form to find value on. Set none to find global list value. KeyName: name of list. slice[]: an initialized array set to the slice size you want, i.e. int[] slice = new int[10] [optional] startIndex: the starting list index you want to start filling your slice array with */ export var IntListSlice = function (ObjKey, KeyName, slice, startIndex) { if (startIndex === void 0) { startIndex = 0; } return sn.IntListSlice(ObjKey, KeyName, slice, startIndex); }; export var FloatListSlice = function (ObjKey, KeyName, slice, startIndex) { if (startIndex === void 0) { startIndex = 0; } return sn.FloatListSlice(ObjKey, KeyName, slice, startIndex); }; export var StringListSlice = function (ObjKey, KeyName, slice, startIndex) { if (startIndex === void 0) { startIndex = 0; } return sn.StringListSlice(ObjKey, KeyName, slice, startIndex); }; export var FormListSlice = function (ObjKey, KeyName, slice, startIndex) { if (startIndex === void 0) { startIndex = 0; } return sn.FormListSlice(ObjKey, KeyName, slice, startIndex); }; /** Sizes the given list to a set number of elements. If the list exists already it will be truncated when given fewer elements, or resized to the appropriate length with the filler argument being used as the default values Returns the number of elements truncated (signed) or added (unsigned) onto the list. ObjKey: form to find value on. Set none to find global list value. KeyName: name of list. toLength: The size you want to change the list to. Max length when using this function is 500. [optional] filler: When adding empty elements to the list this will be used as the default value */ export var IntListResize = function (ObjKey, KeyName, toLength, filler) { if (filler === void 0) { filler = 0; } return sn.IntListResize(ObjKey, KeyName, toLength, filler); }; export var FloatListResize = function (ObjKey, KeyName, toLength, filler) { if (filler === void 0) { filler = 0.0; } return sn.FloatListResize(ObjKey, KeyName, toLength, filler); }; export var StringListResize = function (ObjKey, KeyName, toLength, filler) { if (filler === void 0) { filler = ""; } return sn.StringListResize(ObjKey, KeyName, toLength, filler); }; export var FormListResize = function (ObjKey, KeyName, toLength, filler) { if (filler === void 0) { filler = null; } return sn.FormListResize(ObjKey, KeyName, toLength, filler); }; /** Creates a copy of array on the given storage list at the given object+key, overwriting any list that might already exists. Returns true on success. ObjKey: form to find value on. Set none to find global list value. KeyName: name of list. copy[]: The papyrus array with the content you wish to copy over into StorageUtil [optional] filler: When adding empty elements to the list this will be used as the default value */ export var IntListCopy = function (ObjKey, KeyName, copy) { return sn.IntListCopy(ObjKey, KeyName, copy); }; export var FloatListCopy = function (ObjKey, KeyName, copy) { return sn.FloatListCopy(ObjKey, KeyName, copy); }; export var StringListCopy = function (ObjKey, KeyName, copy) { return sn.StringListCopy(ObjKey, KeyName, copy); }; export var FormListCopy = function (ObjKey, KeyName, copy) { return sn.FormListCopy(ObjKey, KeyName, copy); }; /** Outputs the values currently stored by the given object+key. Returns a new array containing the values. ObjKey: form to find value on. Set none to find global list value. KeyName: name of list. */ export var IntListToArray = function (ObjKey, KeyName) { return sn.IntListToArray(ObjKey, KeyName); }; export var FloatListToArray = function (ObjKey, KeyName) { return sn.FloatListToArray(ObjKey, KeyName); }; export var StringListToArray = function (ObjKey, KeyName) { return sn.StringListToArray(ObjKey, KeyName); }; export var FormListToArray = function (ObjKey, KeyName) { return sn.FormListToArray(ObjKey, KeyName); }; /** Returns array of forms from list that have (or optionally don't have) the specified form types. For valid list of form types, see FormType.psc or http://www.creationkit.com/GetType_-_Form ObjKey: form to find value on. Set none to find global list value. KeyName: name of list. FormTypeIDs[]: The int papyrus array with all the form types you wish to filter for [optional] ReturnMatching: By default, TRUE, the output Form[] array will contain forms from list that match the form types If set to FALSE, inverts the resulting array with forms that have a type that DO NOT match. */ export var FormListFilterByTypes = function (ObjKey, KeyName, FormTypeIDs, ReturnMatching) { if (ReturnMatching === void 0) { ReturnMatching = true; } return sn.FormListFilterByTypes(ObjKey, KeyName, FormTypeIDs, ReturnMatching); }; // Convenience version of FormListFilterByTypes() for when only getting a single type. export var FormListFilterByType = function (ObjKey, KeyName, FormTypeID, ReturnMatching) { if (ReturnMatching === void 0) { ReturnMatching = true; } return sn.FormListFilterByType(ObjKey, KeyName, FormTypeID, ReturnMatching); }; /** Counts each type of of any KeyName that starts with a given string prefix on all objects. PrefixKey: The string a KeyName must start with to be counted. Cannot be empty. */ export var CountIntValuePrefix = function (PrefixKey) { return sn.CountIntValuePrefix(PrefixKey); }; export var CountFloatValuePrefix = function (PrefixKey) { return sn.CountFloatValuePrefix(PrefixKey); }; export var CountStringValuePrefix = function (PrefixKey) { return sn.CountStringValuePrefix(PrefixKey); }; export var CountFormValuePrefix = function (PrefixKey) { return sn.CountFormValuePrefix(PrefixKey); }; export var CountIntListPrefix = function (PrefixKey) { return sn.CountIntListPrefix(PrefixKey); }; export var CountFloatListPrefix = function (PrefixKey) { return sn.CountFloatListPrefix(PrefixKey); }; export var CountStringListPrefix = function (PrefixKey) { return sn.CountStringListPrefix(PrefixKey); }; export var CountFormListPrefix = function (PrefixKey) { return sn.CountFormListPrefix(PrefixKey); }; // Performs all of the above prefix counts in one go. export var CountAllPrefix = function (PrefixKey) { return sn.CountAllPrefix(PrefixKey); }; /** Counts each type of of any KeyName that starts with a given string prefix on all objects. ObjKey: form to perform the prefix count on. PrefixKey: The string a KeyName must start with to be counted. Cannot be empty. */ export var CountObjIntValuePrefix = function (ObjKey, PrefixKey) { return sn.CountObjIntValuePrefix(ObjKey, PrefixKey); }; export var CountObjFloatValuePrefix = function (ObjKey, PrefixKey) { return sn.CountObjFloatValuePrefix(ObjKey, PrefixKey); }; export var CountObjStringValuePrefix = function (ObjKey, PrefixKey) { return sn.CountObjStringValuePrefix(ObjKey, PrefixKey); }; export var CountObjFormValuePrefix = function (ObjKey, PrefixKey) { return sn.CountObjFormValuePrefix(ObjKey, PrefixKey); }; export var CountObjIntListPrefix = function (ObjKey, PrefixKey) { return sn.CountObjIntListPrefix(ObjKey, PrefixKey); }; export var CountObjFloatListPrefix = function (ObjKey, PrefixKey) { return sn.CountObjFloatListPrefix(ObjKey, PrefixKey); }; export var CountObjStringListPrefix = function (ObjKey, PrefixKey) { return sn.CountObjStringListPrefix(ObjKey, PrefixKey); }; export var CountObjFormListPrefix = function (ObjKey, PrefixKey) { return sn.CountObjFormListPrefix(ObjKey, PrefixKey); }; // Performs all of the above prefix counts in one go. export var CountAllObjPrefix = function (ObjKey, PrefixKey) { return sn.CountAllObjPrefix(ObjKey, PrefixKey); }; /** Clears each type of of any KeyName that starts with a given string prefix on all objects. Returns the number of values/lists that were unset. PrefixKey: The string a KeyName must start with to be cleared. Cannot be empty. */ export var ClearIntValuePrefix = function (PrefixKey) { return sn.ClearIntValuePrefix(PrefixKey); }; export var ClearFloatValuePrefix = function (PrefixKey) { return sn.ClearFloatValuePrefix(PrefixKey); }; export var ClearStringValuePrefix = function (PrefixKey) { return sn.ClearStringValuePrefix(PrefixKey); }; export var ClearFormValuePrefix = function (PrefixKey) { return sn.ClearFormValuePrefix(PrefixKey); }; export var ClearIntListPrefix = function (PrefixKey) { return sn.ClearIntListPrefix(PrefixKey); }; export var ClearFloatListPrefix = function (PrefixKey) { return sn.ClearFloatListPrefix(PrefixKey); }; export var ClearStringListPrefix = function (PrefixKey) { return sn.ClearStringListPrefix(PrefixKey); }; export var ClearFormListPrefix = function (PrefixKey) { return sn.ClearFormListPrefix(PrefixKey); }; // Performs all of the above prefix clears in one go. export var ClearAllPrefix = function (PrefixKey) { return sn.ClearAllPrefix(PrefixKey); }; /** Clears each type of of any KeyName that starts with a given string prefix on specific objects. Returns the number of values/lists that were unset. ObjKey: form to perform the prefix clear on. PrefixKey: The string a KeyName must start with to be cleared. Cannot be empty. */ export var ClearObjIntValuePrefix = function (ObjKey, PrefixKey) { return sn.ClearObjIntValuePrefix(ObjKey, PrefixKey); }; export var ClearObjFloatValuePrefix = function (ObjKey, PrefixKey) { return sn.ClearObjFloatValuePrefix(ObjKey, PrefixKey); }; export var ClearObjStringValuePrefix = function (ObjKey, PrefixKey) { return sn.ClearObjStringValuePrefix(ObjKey, PrefixKey); }; export var ClearObjFormValuePrefix = function (ObjKey, PrefixKey) { return sn.ClearObjFormValuePrefix(ObjKey, PrefixKey); }; export var ClearObjIntListPrefix = function (ObjKey, PrefixKey) { return sn.ClearObjIntListPrefix(ObjKey, PrefixKey); }; export var ClearObjFloatListPrefix = function (ObjKey, PrefixKey) { return sn.ClearObjFloatListPrefix(ObjKey, PrefixKey); }; export var ClearObjStringListPrefix = function (ObjKey, PrefixKey) { return sn.ClearObjStringListPrefix(ObjKey, PrefixKey); }; export var ClearObjFormListPrefix = function (ObjKey, PrefixKey) { return sn.ClearObjFormListPrefix(ObjKey, PrefixKey); }; // Performs all of the above prefix clears in one go. export var ClearAllObjPrefix = function (ObjKey, PrefixKey) { return sn.ClearAllObjPrefix(ObjKey, PrefixKey); }; /** Debug functions - can be helpful to find problems or for development. */ export var debug_DeleteValues = function (ObjKey) { return sn.debug_DeleteValues(ObjKey); }; export var debug_DeleteAllValues = function () { return sn.debug_DeleteAllValues(); }; export var debug_Cleanup = function () { return sn.debug_Cleanup(); }; export var debug_AllIntObjs = function () { return sn.debug_AllIntObjs(); }; export var debug_AllFloatObjs = function () { return sn.debug_AllFloatObjs(); }; export var debug_AllStringObjs = function () { return sn.debug_AllStringObjs(); }; export var debug_AllFormObjs = function () { return sn.debug_AllFormObjs(); }; export var debug_AllIntListObjs = function () { return sn.debug_AllIntListObjs(); }; export var debug_AllFloatListObjs = function () { return sn.debug_AllFloatListObjs(); }; export var debug_AllStringListObjs = function () { return sn.debug_AllStringListObjs(); }; export var debug_AllFormListObjs = function () { return sn.debug_AllFormListObjs(); }; export var debug_AllObjIntKeys = function (ObjKey) { return sn.debug_AllObjIntKeys(ObjKey); }; export var debug_AllObjFloatKeys = function (ObjKey) { return sn.debug_AllObjFloatKeys(ObjKey); }; export var debug_AllObjStringKeys = function (ObjKey) { return sn.debug_AllObjStringKeys(ObjKey); }; export var debug_AllObjFormKeys = function (ObjKey) { return sn.debug_AllObjFormKeys(ObjKey); }; export var debug_AllObjIntListKeys = function (ObjKey) { return sn.debug_AllObjIntListKeys(ObjKey); }; export var debug_AllObjFloatListKeys = function (ObjKey) { return sn.debug_AllObjFloatListKeys(ObjKey); }; export var debug_AllObjStringListKeys = function (ObjKey) { return sn.debug_AllObjStringListKeys(ObjKey); }; export var debug_AllObjFormListKeys = function (ObjKey) { return sn.debug_AllObjFormListKeys(ObjKey); }; export var debug_GetIntObjectCount = function () { return sn.debug_GetIntObjectCount(); }; export var debug_GetFloatObjectCount = function () { return sn.debug_GetFloatObjectCount(); }; export var debug_GetStringObjectCount = function () { return sn.debug_GetStringObjectCount(); }; export var debug_GetFormObjectCount = function () { return sn.debug_GetFormObjectCount(); }; export var debug_GetIntListObjectCount = function () { return sn.debug_GetIntListObjectCount(); }; export var debug_GetFloatListObjectCount = function () { return sn.debug_GetFloatListObjectCount(); }; export var debug_GetStringListObjectCount = function () { return sn.debug_GetStringListObjectCount(); }; export var debug_GetFormListObjectCount = function () { return sn.debug_GetFormListObjectCount(); }; export var debug_GetIntObject = function (index) { return sn.debug_GetIntObject(index); }; export var debug_GetFloatObject = function (index) { return sn.debug_GetFloatObject(index); }; export var debug_GetStringObject = function (index) { return sn.debug_GetStringObject(index); }; export var debug_GetFormObject = function (index) { return sn.debug_GetFormObject(index); }; export var debug_GetIntListObject = function (index) { return sn.debug_GetIntListObject(index); }; export var debug_GetFloatListObject = function (index) { return sn.debug_GetFloatListObject(index); }; export var debug_GetStringListObject = function (index) { return sn.debug_GetStringListObject(index); }; export var debug_GetFormListObject = function (index) { return sn.debug_GetFormListObject(index); }; export var debug_GetIntKeysCount = function (ObjKey) { return sn.debug_GetIntKeysCount(ObjKey); }; export var debug_GetFloatKeysCount = function (ObjKey) { return sn.debug_GetFloatKeysCount(ObjKey); }; export var debug_GetStringKeysCount = function (ObjKey) { return sn.debug_GetStringKeysCount(ObjKey); }; export var debug_GetFormKeysCount = function (ObjKey) { return sn.debug_GetFormKeysCount(ObjKey); }; export var debug_GetIntListKeysCount = function (ObjKey) { return sn.debug_GetIntListKeysCount(ObjKey); }; export var debug_GetFloatListKeysCount = function (ObjKey) { return sn.debug_GetFloatListKeysCount(ObjKey); }; export var debug_GetStringListKeysCount = function (ObjKey) { return sn.debug_GetStringListKeysCount(ObjKey); }; export var debug_GetFormListKeysCount = function (ObjKey) { return sn.debug_GetFormListKeysCount(ObjKey); }; export var debug_GetIntKey = function (ObjKey, index) { return sn.debug_GetIntKey(ObjKey, index); }; export var debug_GetFloatKey = function (ObjKey, index) { return sn.debug_GetFloatKey(ObjKey, index); }; export var debug_GetStringKey = function (ObjKey, index) { return sn.debug_GetStringKey(ObjKey, index); }; export var debug_GetFormKey = function (ObjKey, index) { return sn.debug_GetFormKey(ObjKey, index); }; export var debug_GetIntListKey = function (ObjKey, index) { return sn.debug_GetIntListKey(ObjKey, index); }; export var debug_GetFloatListKey = function (ObjKey, index) { return sn.debug_GetFloatListKey(ObjKey, index); }; export var debug_GetStringListKey = function (ObjKey, index) { return sn.debug_GetStringListKey(ObjKey, index); }; export var debug_GetFormListKey = function (ObjKey, index) { return sn.debug_GetFormListKey(ObjKey, index); }; /** Storage functions - separate file. These are shared in all save games. Values are loaded and saved when savegame is loaded or saved. DEPRECATED v2.9: Replaced by JsonUtil functions. Existing functions here have been proxied to a shared json file to maintain compatibility. */ export var FileSetIntValue = function (KeyName, value) { return sn.FileSetIntValue(KeyName, value); }; export var FileSetFloatValue = function (KeyName, value) { return sn.FileSetFloatValue(KeyName, value); }; export var FileSetStringValue = function (KeyName, value) { return sn.FileSetStringValue(KeyName, value); }; export var FileSetFormValue = function (KeyName, value) { return sn.FileSetFormValue(KeyName, value); }; export var FileAdjustIntValue = function (KeyName, amount) { return sn.FileAdjustIntValue(KeyName, amount); }; export var FileAdjustFloatValue = function (KeyName, amount) { return sn.FileAdjustFloatValue(KeyName, amount); }; export var FileUnsetIntValue = function (KeyName) { return sn.FileUnsetIntValue(KeyName); }; export var FileUnsetFloatValue = function (KeyName) { return sn.FileUnsetFloatValue(KeyName); }; export var FileUnsetStringValue = function (KeyName) { return sn.FileUnsetStringValue(KeyName); }; export var FileUnsetFormValue = function (KeyName) { return sn.FileUnsetFormValue(KeyName); }; export var FileHasIntValue = function (KeyName) { return sn.FileHasIntValue(KeyName); }; export var FileHasFloatValue = function (KeyName) { return sn.FileHasFloatValue(KeyName); }; export var FileHasStringValue = function (KeyName) { return sn.FileHasStringValue(KeyName); }; export var FileHasFormValue = function (KeyName) { return sn.FileHasFormValue(KeyName); }; export var FileGetIntValue = function (KeyName, missing) { if (missing === void 0) { missing = 0; } return sn.FileGetIntValue(KeyName, missing); }; export var FileGetFloatValue = function (KeyName, missing) { if (missing === void 0) { missing = 0.0; } return sn.FileGetFloatValue(KeyName, missing); }; export var FileGetStringValue = function (KeyName, missing) { if (missing === void 0) { missing = ""; } return sn.FileGetStringValue(KeyName, missing); }; export var FileGetFormValue = function (KeyName, missing) { if (missing === void 0) { missing = null; } return sn.FileGetFormValue(KeyName, missing); }; export var FileIntListAdd = function (KeyName, value, allowDuplicate) { if (allowDuplicate === void 0) { allowDuplicate = true; } return sn.FileIntListAdd(KeyName, value, allowDuplicate); }; export var FileFloatListAdd = function (KeyName, value, allowDuplicate) { if (allowDuplicate === void 0) { allowDuplicate = true; } return sn.FileFloatListAdd(KeyName, value, allowDuplicate); }; export var FileStringListAdd = function (KeyName, value, allowDuplicate) { if (allowDuplicate === void 0) { allowDuplicate = true; } return sn.FileStringListAdd(KeyName, value, allowDuplicate); }; export var FileFormListAdd = function (KeyName, value, allowDuplicate) { if (allowDuplicate === void 0) { allowDuplicate = true; } return sn.FileFormListAdd(KeyName, value, allowDuplicate); }; export var FileIntListAdjust = function (KeyName, index, amount) { return sn.FileIntListAdjust(KeyName, index, amount); }; export var FileFloatListAdjust = function (KeyName, index, amount) { return sn.FileFloatListAdjust(KeyName, index, amount); }; export var FileIntListRemove = function (KeyName, value, allInstances) { if (allInstances === void 0) { allInstances = false; } return sn.FileIntListRemove(KeyName, value, allInstances); }; export var FileFloatListRemove = function (KeyName, value, allInstances) { if (allInstances === void 0) { allInstances = false; } return sn.FileFloatListRemove(KeyName, value, allInstances); }; export var FileStringListRemove = function (KeyName, value, allInstances) { if (allInstances === void 0) { allInstances = false; } return sn.FileStringListRemove(KeyName, value, allInstances); }; export var FileFormListRemove = function (KeyName, value, allInstances) { if (allInstances === void 0) { allInstances = false; } return sn.FileFormListRemove(KeyName, value, allInstances); }; export var FileIntListGet = function (KeyName, index) { return sn.FileIntListGet(KeyName, index); }; export var FileFloatListGet = function (KeyName, index) { return sn.FileFloatListGet(KeyName, index); }; export var FileStringListGet = function (KeyName, index) { return sn.FileStringListGet(KeyName, index); }; export var FileFormListGet = function (KeyName, index) { return sn.FileFormListGet(KeyName, index); }; export var FileIntListSet = function (KeyName, index, value) { return sn.FileIntListSet(KeyName, index, value); }; export var FileFloatListSet = function (KeyName, index, value) { return sn.FileFloatListSet(KeyName, index, value); }; export var FileStringListSet = function (KeyName, index, value) { return sn.FileStringListSet(KeyName, index, value); }; export var FileFormListSet = function (KeyName, index, value) { return sn.FileFormListSet(KeyName, index, value); }; export var FileIntListClear = function (KeyName) { return sn.FileIntListClear(KeyName); }; export var FileFloatListClear = function (KeyName) { return sn.FileFloatListClear(KeyName); }; export var FileStringListClear = function (KeyName) { return sn.FileStringListClear(KeyName); }; export var FileFormListClear = function (KeyName) { return sn.FileFormListClear(KeyName); }; export var FileIntListRemoveAt = function (KeyName, index) { return sn.FileIntListRemoveAt(KeyName, index); }; export var FileFloatListRemoveAt = function (KeyName, index) { return sn.FileFloatListRemoveAt(KeyName, index); }; export var FileStringListRemoveAt = function (KeyName, index) { return sn.FileStringListRemoveAt(KeyName, index); }; export var FileFormListRemoveAt = function (KeyName, index) { return sn.FileFormListRemoveAt(KeyName, index); }; export var FileIntListInsert = function (KeyName, index, value) { return sn.FileIntListInsert(KeyName, index, value); }; export var FileFloatListInsert = function (KeyName, index, value) { return sn.FileFloatListInsert(KeyName, index, value); }; export var FileStringListInsert = function (KeyName, index, value) { return sn.FileStringListInsert(KeyName, index, value); }; export var FileFormListInsert = function (KeyName, index, value) { return sn.FileFormListInsert(KeyName, index, value); }; export var FileIntListCount = function (KeyName) { return sn.FileIntListCount(KeyName); }; export var FileFloatListCount = function (KeyName) { return sn.FileFloatListCount(KeyName); }; export var FileStringListCount = function (KeyName) { return sn.FileStringListCount(KeyName); }; export var FileFormListCount = function (KeyName) { return sn.FileFormListCount(KeyName); }; export var FileIntListFind = function (KeyName, value) { return sn.FileIntListFind(KeyName, value); }; export var FileFloatListFind = function (KeyName, value) { return sn.FileFloatListFind(KeyName, value); }; export var FileStringListFind = function (KeyName, value) { return sn.FileStringListFind(KeyName, value); }; export var FileFormListFind = function (KeyName, value) { return sn.FileFormListFind(KeyName, value); }; export var FileIntListHas = function (KeyName, value) { return sn.FileIntListHas(KeyName, value); }; export var FileFloatListHas = function (KeyName, value) { return sn.FileFloatListHas(KeyName, value); }; export var FileStringListHas = function (KeyName, value) { return sn.FileStringListHas(KeyName, value); }; export var FileFormListHas = function (KeyName, value) { return sn.FileFormListHas(KeyName, value); }; export var FileIntListSlice = function (KeyName, slice, startIndex) { if (startIndex === void 0) { startIndex = 0; } return sn.FileIntListSlice(KeyName, slice, startIndex); }; export var FileFloatListSlice = function (KeyName, slice, startIndex) { if (startIndex === void 0) { startIndex = 0; } return sn.FileFloatListSlice(KeyName, slice, startIndex); }; export var FileStringListSlice = function (KeyName, slice, startIndex) { if (startIndex === void 0) { startIndex = 0; } return sn.FileStringListSlice(KeyName, slice, startIndex); }; export var FileFormListSlice = function (KeyName, slice, startIndex) { if (startIndex === void 0) { startIndex = 0; } return sn.FileFormListSlice(KeyName, slice, startIndex); }; export var FileIntListResize = function (KeyName, toLength, filler) { if (filler === void 0) { filler = 0; } return sn.FileIntListResize(KeyName, toLength, filler); }; export var FileFloatListResize = function (KeyName, toLength, filler) { if (filler === void 0) { filler = 0.0; } return sn.FileFloatListResize(KeyName, toLength, filler); }; export var FileStringListResize = function (KeyName, toLength, filler) { if (filler === void 0) { filler = ""; } return sn.FileStringListResize(KeyName, toLength, filler); }; export var FileFormListResize = function (KeyName, toLength, filler) { if (filler === void 0) { filler = null; } return sn.FileFormListResize(KeyName, toLength, filler); }; export var FileIntListCopy = function (KeyName, copy) { return sn.FileIntListCopy(KeyName, copy); }; export var FileFloatListCopy = function (KeyName, copy) { return sn.FileFloatListCopy(KeyName, copy); }; export var FileStringListCopy = function (KeyName, copy) { return sn.FileStringListCopy(KeyName, copy); }; export var FileFormListCopy = function (KeyName, copy) { return sn.FileFormListCopy(KeyName, copy); }; export var debug_SaveFile = function () { return sn.debug_SaveFile(); }; /** Currently no longer implemented, unknown if/when they will return. */ export var debug_FileGetIntKeysCount = function () { return sn.debug_FileGetIntKeysCount(); }; 0; export var debug_FileGetFloatKeysCount = function () { return sn.debug_FileGetFloatKeysCount(); }; 0; export var debug_FileGetStringKeysCount = function () { return sn.debug_FileGetStringKeysCount(); }; 0; export var debug_FileGetIntListKeysCount = function () { return sn.debug_FileGetIntListKeysCount(); }; 0; export var debug_FileGetFloatListKeysCount = function () { return sn.debug_FileGetFloatListKeysCount(); }; 0; export var debug_FileGetStringListKeysCount = function () { return sn.debug_FileGetStringListKeysCount(); }; 0; export var debug_FileGetIntKey = function (index) { return sn.debug_FileGetIntKey(index); }; ""; export var debug_FileGetFloatKey = function (index) { return sn.debug_FileGetFloatKey(index); }; ""; export var debug_FileGetStringKey = function (index) { return sn.debug_FileGetStringKey(index); }; ""; export var debug_FileGetIntListKey = function (index) { return sn.debug_FileGetIntListKey(index); }; ""; export var debug_FileGetFloatListKey = function (index) { return sn.debug_FileGetFloatListKey(index); }; ""; export var debug_FileGetStringListKey = function (index) { return sn.debug_FileGetStringListKey(index); }; ""; export var debug_FileDeleteAllValues = function () { return sn.debug_FileDeleteAllValues(); }; export var debug_SetDebugMode = function (enabled) { return sn.debug_SetDebugMode(enabled); }; export var ImportFile = function (fileName, restrictKey, restrictType, restrictForm, restrictGlobal, keyContains) { if (restrictKey === void 0) { restrictKey = ""; } if (restrictType === void 0) { restrictType = -1; } if (restrictForm === void 0) { restrictForm = null; } if (restrictGlobal === void 0) { restrictGlobal = false; } if (keyContains === void 0) { keyContains = false; } return sn.ImportFile(fileName, restrictKey, restrictType, restrictForm, restrictGlobal, keyContains); }; false; export var ExportFile = function (fileName, restrictKey, restrictType, restrictForm, restrictGlobal, keyContains, append) { if (restrictKey === void 0) { restrictKey = ""; } if (restrictType === void 0) { restrictType = -1; } if (restrictForm === void 0) { restrictForm = null; } if (restrictGlobal === void 0) { restrictGlobal = false; } if (keyContains === void 0) { keyContains = false; } if (append === void 0) { append = true; } return sn.ExportFile(fileName, restrictKey, restrictType, restrictForm, restrictGlobal, keyContains, append); }; false;