SetFloatInArray
Revision as of 15:59, 14 February 2008 by imported>Haama (Created)
Beta Function
This function has not been fully tested yet, and is not ready to be used in a released mod. It may not have the same function in later versions, may require the script to be recompiled, or simply may be removed. Use for testing purposes only until the author of the function says otherwise.
A command for Pluggy
Syntax:
SetFloatInArray ArrayID:long Index:long Value:long BlockSize:long Global:short
Stores the Value at Index.
- This can only be used to store floats.
- Use SetRefInArray and SetInArray for other value types.
- 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
SetFloatInArray 1 0 .5 SetFloatInArray 1 1 .10 SetFloatInArray 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)
SetFloatInArray 0 5 .150 2
Index | Array 0 Value |
---|---|
Index 0 | Empty |
Index 1 | 50 |
Index 2 | 2000 |
Index 3 | Empty |
Index 4 | Empty |
Index 5 | .150 |
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.