debug()

(info) Other great resources: Official JS API docs, Scripting Forum

debug()

Outputs text to the terminal or log file depending on operating system.

 

Syntax

try { debug(text); } catch(e) { console(e.message); // error occurred }

Parameters

Parameter

Type

Mandatory

Description

Game version

text

String

The text to output to the command line.

3.1 Beta 1

Return value

Value

Type

Description

Game version

undefined

Undefined

The text was successfully sent to the console / logs.

3.1 Beta 1

<error>

Error

If something went wrong, eg. unable to write to the logs, an error will be thrown.

3.1 Beta 1

Example

Send some text to the terminal
debug("Greetings Commander!");

Notes

As of Warzone 3.1 RC3 (and earlier) the output will go to different places depending on operating system:

Operating System

Output location

Microsoft Windows

Windows Debugger

Duha's Debug Reader provides an easier way to see the output.

Apple OS X

System console (also known as "System Messages")

View using Console.app.

Linux

Linux console

There are some plans to update the debug() function so that it always outputs to the Warzone log file regardless of operating system.

Messages sent using debug() can be put in to the Warzone log file by using the command line option:

warzone2100 --debug=script