Mod:Creation Kit/CheckLocationAgainstArray - CommonArrayFunctions

Member of: Mod:Creation Kit/CommonArrayFunctions Script

Checks to see if the specified location is in the array, or optionally is a child of one of the locations in the array.

Syntax
bool Function CheckLocationAgainstArray(Location ObjectToCheck, Location[] ArrayToCheck, \ bool returnValueIfArrayIsEmpty = false, bool matchIfChildLocation = false) global

Parameters

 * ObjectToCheck: The Location we are looking for
 * ArrayToCheck: The Location array we are looking in
 * returnValueIfArrayIsEmpty: If the array is empty, return this.
 * Default: False
 * matchIfChildLocation: If true, will check each location to see if ObjectToCheck is a child of the location
 * Default: False

Return Value

 * True: If the ObjectToCheck is one of the locations in ArrayToCheck (or a child, if matchIfChildLocation)
 * False: If the ObjectToCheck has not one of the locations in ArrayToCheck (and not a child, if matchIfChildLocation)
 * False: If ObjectToCheck is None
 * returnValueIfArrayIsEmpty: If ArrayToCheck is Empty/None

Examples
if CommonArrayFunctions.CheckLocationAgainstArray(PlayerLocation, DiamondCityLocations, matchIfChildLocation = true) Debug.Trace("Player is in a diamond city location! (or a child thereof)") endIf