ARRAY COMMANDS
The max array size is 8388607.
The theorical max global array count is 8388607.
ArrayCmp
ArrayCmp compares two arrays. It returns 1 if equal, or 0 if different.
If CheckValidy is different than zero then ArrayCmp:
returns -1
if the first array is invalid.
returns -2
if the second array is invalid.
returns -3
if both arrays are invalid.
The comparison ignores the EspID.
(Result:short) ArrayCount <ArrayID:long>
<ArrayID:long> <CheckValidity:short=0>
ArrayCount
ArrayCounts returns the count of indexes that contains data.
If the array does not exist, it returns -1.
(Count:long) ArrayCount <ArrayID:long>
ArrayEsp
ArrayEsp sets the array EspID to the specified EspID, and returns the EspID.
If EspID is not specified or invalid, it returns the current EspID.
If the array does not exists, it returns -1.
If Global = 0 then the function fails if you try to change the EspID of an
array not associated to the calling esp. Global to 1 is required if you need to
modify an array of another esp.
(EspID:short) ArrayEsp <ArrayID:long>
<EspID:short=-1> <Global:short=0>
ArrayProtect
ArrayProtect sets the Protected flag of the array.
If Protected is not specified, it returns the current Protected flag state.
If the array does not exists, it returns -1.
Only the esp associated with the array can modify the Protected flag.
(State:short) ArrayProtect <ArrayID:long>
<Protected:short=-1>
ArraySize
ArraySize sets the array to the specified size, and returns the new size.
If Size is not specified, it returns the current size.
If the array does not exist, it returns -1.
If Global = 0 then the function fails if you try to modify the size of an array
not associated to the calling esp. Global to 1 is required if you need to
modify an array of another esp.
(Size:long) ArraySize <ArrayID:long>
<Size:long=-1> <Global:short=0>
CopyArray (alt:
DupArray)
CopyArray creates a copy of an array and returns the newly created ArrayID.
If the original array does not exist, it returns -1.
If Size is not specified, the new array size is the same as the original, else
the new array will be of the specified size (truncated or expanded).
If RefuseZero is not 0, then the returned StringID will never be zero.
The new array has its EspID set to the calling esp.
(ArrayID:long) CopyArray <ArrayID:long>
<Size:long=-1> <RefuseZero:long=0>
CreateArray
CreateArray creates a new array tagged with the EspID, and returns the ArrayID.
If EspID is not specified then the EspID is automatically associated to the
calling esp
If Protected is not 0, then the array will be write-protected from other esp,
and only the associated ESP will ever be able to modify the array. Setting
Protected to 1 is recommended if you don’t want that your array can be
modified by other esp.
If RefuseZero is not 0, then the returned StringID will never be zero.
If the ESP file is not active upon reloading a savegame, all the associated
arrays are destroyed.
Attention: It is strongly recommended to set
Protected to 1 if you do not specifically need the array to be modified by
another esp.
(ArrayID:long) CreateArray <EspID:short=-1> <Size:long=0>
<Protected:Short=0> <RefuseZero:Short=0>
DestroyAllArrays
DestroyArray destroys all the array associated to the EspID.
If EspID is not specified then the EspID is automatically associated to the
calling esp
DestroyAllArrays <EspID:short=-1>
DestroyArray
DestroyArray destroys the array.
If Global = 0 then the function fails if you try to destroy an array not
associated to the calling esp. Setting Global to 1 is required if you need to
modify an array of another esp.
DestroyArray
<ArrayID:long> <Global:short=0>
FindFloatInArray
FindFloatInArray returns the index of the first occurrence of Value between
indexes Start & Stop in the array
It returns -1 if no occurrence is found.
(Index: long) FindFloatInArray <ArrayID:long> <Value:float>
<Start:long=0> <Stop:long=LastIndex>
FindInArray
FindInArray returns the index of the first occurrence of Value between indexes
Start & Stop in the array
It returns -1 if no occurrence is found.
(Index: long) FindInArray <ArrayID:long>
<Value:float> <Start:long=0> <Stop:long=LastIndex>
FindRefInArray
FindRefInArray returns the index of the first occurrence of Value between
indexes Start & Stop in the array
It returns -1 if no occurrence is found.
Attention: FindRefInArray only works with local
ref variable. If you need to use an external ref variable, assign the value to
a local ref used with FindRefInArray.
(Index: long) FindRefInArray <ArrayID:long>
<Value:ref> <Start:long=0>
<Stop:long=LastIndex>
FirstInArray
(alt: FirstFreeInArray)
FirstInArray returns the first Index containing no value if Used = 0, else
returns the first Index containing a value. The search is done between indexes
Start & Stop in the array.
It returns -1 if the search is unsuccessfull, or if the array does not exist.
(Index: long) FirstInArray <ArrayID:long><Used:Short=0>
<Start:long=0> <Stop:long=LastIndex>
GetInArray
GetInArray gets the Value at Index in the array
If there is no item existing item at Index, then it returns 0.
(Value:ref / long / float) GetInArray <ArrayID:long> <Index:long>
GetTypeInArray
GetTypeInArray gets the item type at Index in the array
It returns 0 if item is a long.
It returns 1 if item is a reference.
It retuns 2 if item is a float
It returns -1 if no item exists at Index
(Type: short) GetTypeInArray <ArrayID:long>
<Index:long>
PackArray
PackArray will remove all unused indexes gaps in the array, and then resize the
array to the values count.
If Global = 0 then the function fails if you try to modify an array not
associated to the calling esp. Global to 1 is required if you need to modify an
array of another esp.
Attention: Since PackArray moves the values of
the array to fill the gaps, any index from the array stored in script before
the operation will become meaningless
PackArray <ArrayID:long> <Global:short=0>
RemInArray
RemInArray removes the item at Index from the array
If Global = 0 then the function fails if you try to modify an array not
associated to the calling esp. Global to 1 is required if you need to modify an
array of another esp.
If RemoveGap is different than zero, the function will move up by 1 all the
elements following Index, and reduce the array size by 1, thus removing the gap
made by the removed Index.
RemInArray <ArrayID:long> <Index:long>
<Global:short=0> <RemoveGap:short=0>
SetFloatInArray
SetFloatInArray sets the item Value at Index in the array
If an item is already existing at Index, then its value is overwritten, else a
new item is created
If Index >= array size , and BlockSize > 0, then the array size will be
automaticly incremented by the necessary amount of BlockSize until the Index
will be valid. (By default BlockSize = 0).
If Global = 0 then the function fails if you try to modify an array not
associated to the calling esp. Global to 1 is required if you need to modify an
array of another esp.
If Insert is different than zero, the function will increase the array size by
1, and the elements from Index to the end of the array with be moved down by 1,
thus inserting a gap at Index.
SetFloatInArray <ArrayID:long> <Index:long> <Value:
float> <BlockSize:long=0> <Global:short=0>
<Insert:short=0>
SetInArray
SetInArray sets the item to Value at Index in the array ( Useable Indexes are
from 0 to (array size -1).
If an item is already existing at Index, then its value is overwritten, else a
new item is created
If Index >= array size , and BlockSize > 0, then the array size will be
automaticly incremented by the necessary amount of BlockSize until the Index
will be valid.
If Global = 0 then the function fails if you try to modify an array not
associated to the calling esp. Global to 1 is required if you need to modify an
array of another esp.
If Insert is different than zero, the function will increase the array size by
1, and the elements from Index to the end of the array with be moved down by 1,
thus inserting a gap at Index.
SetInArray <ArrayID:long> <Index:long>
<Value: long> <BlockSize:long=0>
<Global:short=0> <Insert:short=0>
SetRefInArray
SetRefInArray sets the item to Value at Index in the array.
If an item is already existing at Index, then its value is overwritten, else a
new item is created.
If Index >= array size, and BlockSize > 0, then the array size will be
automaticly incremented by the necessary amount of BlockSize until the Index
will be valid.
If Global = 0 then the function fails if you try to modify an array not
associated to the calling esp. Global to 1 is required if you need to modify an
array of another esp.
If Insert is different than zero, the function will increase the array size by
1, and the elements from Index to the end of the array with be moved down by 1,
thus inserting a gap at Index.
Attention: SetRefInArray only works with local
ref variable. If you need to use an external ref variable, assign the value to
a local ref used with SetRefInArray.
SetRefInArray
<ArrayID:long> <Index:long>
<Value: ref> <BlockSize:longe=0>
<Global:short=0> <Insert:short=0>