(info) This AI is still in early stages of development.

Globals

Useful global methods and properties...

 

Overview

Util API adds a number of useful features to the global scope (so they can be used anywhere).

Note: These are not related to the Globals defined by the Javascript API.

Both global and Native are references to the global object (not scope) which is where native Javascript objects and Warzone JS API features are located.

The now property returns the current time in milliseconds, useful for timing code execution.

The toArray() function converts an array-like object in to a real array, ideal for turning 'arguments' object inside a function in to something more flexible.

Finally, the out() function can be used to output a message via a specific method, such as an error or a chat message. It transparently deals with missing features in earlier versions of Warzone.

Availability STABLE

Requires:

Globals

Topics:

  • NativeAllows access to JS API natives that have been replaced or removed by the Define API...
  • toArray()Convert an array-like object in to an array...
  • nowReturn current universal time expressed as milliseconds since midnight, January 1, 1970.
  • out()Message output handler.
    • out.HOSTOutputs the message to the game host via in-game chat .
    • out.DEFAULTOutputs the message via out.HOST or out.CONSOLE depending on Warzone version.
    • out.ERROROutputs the message as an exception.
    • out.DEBUGOutput message to debug().
    • out.CONSOLEOutput message to console().
    • out.ASSERTAsserts whether config is truthy, and if not throws a game assert and a Javascript error...
    • out.CHATOutputs the message to allies of the script player via in-game chat.
    • out.RETURNReturns the message to the calling script.
  • difficultyScale()Select a value based on difficulty level...
  • globalA global reference to the global object...