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

out.ASSERT

Asserts whether config is truthy, and if not throws a game assert and a Javascript error...

 

Notes

This requires the hackAssert() function in Warzone 3.2 or above. If that function is not available, it will fall back to just throwing a Javascript error which will still be logged but won't cause a game assert.

The value of config will be evaluated to determine if it is truthy or falsey:

  • truthy – nothing will happen, the game will continue as normal
  • falsey – a 'game assert' is thrown, followed by a Javascript Error

When a 'game assert' is thrown, a game error will be logged. If a debugger is connected to the game, Warzone will halt and allow you to inspect game state via the debugger, otherwise the game will continue.

If the (optional) self parameter is specified, the message associated with the assertion will be prefixed with the filename and version defined in the Self Descriptor Object.

Example

out("This should be true", null, out.ASSERT, true); // does nothing
 
out("This should be true", null, out.ASSERT, false); // throws game assert & JS error
Availability STABLE

Requires:

Reverts to out.ERROR on earlier versions of Warzone.

See also

Related constants:

  • 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.CONSOLEOutput message to console().
  • out.DEBUGOutput message to debug().
  • out.DEFAULTOutputs the message via out.HOST or out.CONSOLE depending on Warzone version.
  • out.ERROROutputs the message as an exception.
  • out.HOSTOutputs the message to the game host via in-game chat .
  • out.RETURNReturns the message to the calling script.