global_array.scr

Dependencies

#include "maps/global_scripts/global_common.scr"

Purpose

Can create and access an array of floating point values

*** WARNING ***
This is a HACKED method for doing this! Unless you trully understand what arrays are and how to use them, DO NOT USE THIS SCRIPT!

How To Use

You first run the setup function, passing a unique identifier for the array, and the number of elements you want in the array. This initializes the array and gets it ready for use. Then use the get and set functions to access the array, using the unique identifier. You can have as many array's as you'd like, as long as they all have unique identifiers to differenciate them.

External Functions:

globalArray_FloatSetup( strArrayName, intNumberOfElements )

Purpose:
Initializes and sets up the array with the desired number or elements

    Parms:
  • strArrayName - (string)
    A unique identifier for the array.
  • intNumberOfElements - (float)
    The number of elements to initialize the array to. Once this has been set, you can not change this. The element numbering starts from 1 and goes up. DO NOT PUT ANYTHING AT ELEMENT 0!

globalArray_FloatSet( strArrayName, intElementToSet, intValueToSet )

Purpose:
Sets a value into the desired array at the desired element. DO NOT PUT ANYTHING AT ELEMENT 0!

    Parms:
  • strArrayName (string)
    The unique identifier of the array to set a value on.
  • intElementToSet (float)
    The element number at which to set the value.
  • intValueToSet (float)
    The value to set.

float globalArray_FloatGet( strArrayName, intElementToGet )

Purpose:
Gets a value from the desired array at the desired element.

Returns:
F loat, the value stored at the desired element.

    Parms:
  • strArrayName (string)
    The unique identifier of the array to get a value from.
  • intElementToSet (float)
    The element number at which to get a value from.

float globalArray_FloatHasMatchingValue( strArrayName, float intValueToCheck )

Purpose:
Checks the desired array to see if any element contains a particular value

Returns:
float, the element at which the value was found. If it was not found in the array
it will return 0

    Parms:
  • strArrayName (string)
    The unique identifier of the array to check.
  • intValueToCheck (float)
    The value to check for in the array.