CheckLocationAgainstArray - CommonArrayFunctions

Member of: 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.

SyntaxEdit

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

ParametersEdit

  • 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 ValueEdit

  • 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

ExamplesEdit

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

See AlsoEdit