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

out()

Message output handler.

 

Syntax

out(message[, sdo[, method[, config]]]);

Parameters

ParameterTypeMandatoryDescriptionAPI Version
message

String

Array of String

(tick)

The message to output – either a single string or an array of strings.

1.0
sdoSelf Descriptor Object(error)

Optional descriptor object, used to create a prefix to the message before it is output.

If you're using the method or config params, but don't want to use an SDO, specify null.

Default: No prefix

1.0
methodConstant(error)

Constant defining desired output destination:

  • out.ASSERT — Asserts whether config is truthy, and if not throws a game assert and a Javascript error...
  • out.CHAT — Outputs the message to allies of the script player via in-game chat.
  • out.CONSOLE — Output message to console().
  • out.DEBUG — Output message to debug().
  • out.DEFAULT — Outputs the message via out.HOST or out.CONSOLE depending on Warzone version.
  • out.ERROR — Outputs the message as an exception.
  • out.HOST — Outputs the message to the game host via in-game chat .
  • out.RETURN — Returns the message to the calling script.

Default: out.DEFAULT

1.0
configVariant(error)

Optional method-specific config:

  • If using method out.CHAT, config can be either a specific player ID, ALLIES or ALL_PLAYERS. Defaults to ALLIES.
  • If using method out.ERROR, config can specify a specific error class to use (eg. TypeError). Default: Error
  • If using method out.ASSERT, config is the value being asserted
1.0

Return value

The return value of the output method will be returned (see documentation for out.* constants above for more information).

Example

Output single line of text to console
var self = {file: "foo.js", ver: 1.2};
 
out("hello", self, out.CONSOLE); // "[foo.js v1.2] hello"
Multi-line output
out(["bob", "jim", "kate"]); // outputs each name on a new line to out.DEFAULT
Availability STABLE

This feature requires:

Contents

Jump to:

See also

Related articles:

Related APIs:

  • Chat API – allows scripts to define chat commands and conversations.
  • Diag API – allows scripts to provide diagnostic routines.

Globals

Topics:

  • Native — Allows 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...
  • now — Return current universal time expressed as milliseconds since midnight, January 1, 1970.
  • out() — Message output handler.
    • out.HOST — Outputs the message to the game host via in-game chat .
    • out.DEFAULT — Outputs the message via out.HOST or out.CONSOLE depending on Warzone version.
    • out.ERROR — Outputs the message as an exception.
    • out.DEBUG — Output message to debug().
    • out.CONSOLE — Output message to console().
    • out.ASSERT — Asserts whether config is truthy, and if not throws a game assert and a Javascript error...
    • out.CHAT — Outputs the message to allies of the script player via in-game chat.
    • out.RETURN — Returns the message to the calling script.
  • difficultyScale() — Select a value based on difficulty level...
  • global — A global reference to the global object...

Â