Blog from February, 2012

All Functions pages that have headings now have up-to-date "return values" specified. I went through all of them in the C++ source code to check exactly what's returned (smile)

Any that have an <error> value should be wrapped in "try .. catch" clauses to avoid your script borking if Warzone throws an error. If you're not familiar with Error objects, check out MDN as they have lots of good documentation and examples.

Case sensitivity for globals
Just a quick update to highlight there's an issue with using case-sensitive globals...

From the JS API docs:

6.1 Case sensitivity

Due to a bug that is not so easy to fix in the short term, variables defined in global must be case insensitive. Otherwise, they may collide on savegame loading. This is only for variables defined in your script. There is no need to maintain case insensitivity in regards to variables defined in global by the game itself, such as ’FACTORY’ (you can safely define your own ’factory’ variable) – the only exception to this is ’me’.

The JS API in Master just got updated with a bunch of bugfixes and new stuff such as chat, droid orders and gateways...

Here's the details from Per (original post):

Added:
* chat(target, message), for sending chat messages. chat may be ALL_PLAYERS or ALLIES or a specific player number
* orderDroid(droid, order), with new orders DORDER_STOP, DORDER_HOLD, DORDER_RTR, DORDER_RTB
* DORDER_FIRESUPPORT
* DORDER_REARM, and it may be used both with orderDroid() and orderDroidObj()
* enumGateways(), gives array of objects with x1, y1, x2, y2 properties (what are gateways?)
* .hasIndirect property for droids, if any weapons are indirect (eg artillery)

Fixed .armed and .range properties. The .group and .armed properties are now null instead of undefined if not applicable.

All of this is for 3.2 only at the moment.

You'll notice that top of the list is the first signs of chat functionality in the API which is going to open up a really interesting new area for us JS scripters!

(warning) Some discrepancies have crept in to the JS API documentation for droid objects, more info here.

The changes are on my to-do list and should be reflected on this site within the next couple of days.