SetInArray

From the Oblivion ConstructionSet Wiki
Revision as of 11:57, 26 February 2008 by imported>Speedo
Jump to navigation Jump to search


A command for Pluggy

Syntax:

SetInArray ArrayID:long Index:long Value:long BlockSize:long Global:short

Stores the Value at Index.

  • This can only be used to store integers (short and long).
  • Useable Indexes are from 0 to (array size -1).
  • If a value is already existing at Index, then the original value is overwritten.
  • 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 you want to modify an array from another mod, you will need to set the Global flag to 1. If Global is 0 or unset the function will fail. If the array is protected the function will fail.

Example:

Assume two Arrays (0 and 1) with the indexes:

Index Array 0 Value Array 1 Value
Index 0 Empty Empty
Index 1 50 100
Index 2 2000 1000

then

SetInArray 1 0 5
SetInArray 1 1 10
SetInArray 0 2 7

will change them to

Index Array 0 Value Array 1 Value
Index 0 Empty 5
Index 1 50 10
Index 2 7 1000

Blocksize example (using the original Array 0)

SetInArray 0 5 1000 2
Index Array 0 Value
Index 0 Empty
Index 1 50
Index 2 2000
Index 3 Empty
Index 4 Empty
Index 5 1000
Index 6 Empty

The array size is increased by two until the desired index is included. In this case, the array size is first increased from 3 to 5. This doesn't include index 5 (which is the 6th index as index starts at 0). It is increased again to 7, which does include index 5.