Other great resources: Official JS API docs, Scripting Forum
Native JS Features
A summary of the native Javascript features of the Warzone JS environment.
Native JS Environment Features
To find out what's in the JS environment, I used my tracebot AI script to prod and poke at various things.
Each of the headings below represents something I looked at (eg. Object = the JS Object class) followed by a bullet list of what I found. I've linked standard JS properties and methods to the related documentation on Mozilla Developer Network.
The properties are listed in the order returned by Object.getOwnPropertyNames(obj), not alphabetically.
global
The "global" object isn't defined in the WZ JS environment, but we can get at it by running this code on the global scope:
const global = this;It contains:
So there's quite a bit missing compared to what you'd see in a browser.
You'll note that, unusually, escape and unescape are defined in the global object – in browsers those functions usually live on the "window" object, but because Warzone isn't a browser they've been moved.
Object
Object.prototype
Array
Array.__proto__
some() – see iHave(structure) for an example of using this
forEach() – incredibly useful method for AI scripts! See orderGroupObj(group,dorder,obj) for an example of using this.
__proto__ == Object.prototype (see above)
Function
This is the Function constructor on the global object.
Function.prototype
disconnect
connect
function
This is a function object (eg. one of your functions or event handlers), not the Function constructor (see above).
arguments (see below)
callee (non-standard? equivalent to arguments.callee)
__proto__ == Function.prototype (see above)
Note that the .caller property will be the global scope (which is actually a null instance if you try to access it) for functions triggered by Events & Timers (including setTimer(), queue() and bind() triggered functions).
arguments
String.prototype
The string prototype, and this all string object instances, has the following properties/methods:
anchor()
sup()
blink()
strike()
sub()
link()
bold()
italics()
fontsize()
small()
fontcolor()
big()
Items that are striked out are HTML-only features that are not relevant to Warzone.