I've been reviewing the documentation here, and there are a few things I'm hoping devs can answer.

First, how do I find the coordinates of a truck's build order?
How do I order a droid to recycle?
How do I cancel droid production in a factory?
How do I scan for enemies in the player's field of vision?

Doesn't look like order coordinates have been added yet. Seems like something that should be.

The recycle order is in git master (future 3.2). Not sure why it has not been added to 3.1, but probably some reason.

There is currently no way to cancel droid production.

There are two ways to scan for enemies - passively and actively. The passive way is to listen for 'seen' and 'attacked' events, and react to those. The active way is to use enumRange() and enumArea(), but these only exist in git master (future 3.2).

enumStruct() and enumDroid() also support the visibility check; they scan the whole map and pick only visible stuff if the relevant optional argument is set. However, it may be impossible to achieve good performance with these functions, especially if you target high-oil and many objects are present on the map.

Seems hard to hack-backport DORDER_RECYCLE because you'd also need a function for order-without-arguments (that is, you need to get orderDroid() as well, because orderDroidLoc()/orderDroidObj() won't work).

Got more questions. It seems that with timers, it might not be atomic? I hope there aren't two functions running at once? I'm having trouble tracking truck production. I've got a variable to track how many are being built, and a function to count how many exist, but I can't get it to work properly. When a droid is completed (using eventDroidBuilt), if it's a truck, TrucksBeingMade is decremented, and when one is sent to production, it's incremented. Before I implemented TrucksBeingMade, I had problems with factories creating too many trucks and becoming jammed. That can't be fixed because, after all, there is no way to abort factory production and no way to order droids to recycle.

Javascript has no threads, everything is atomic, and there's only one callback running at once.

For stuck on limit, in 3.2 there's getDroidProduction(factory), so that to see how many trucks, including in-production. On 3.1 i just limit trucks to less than 10, so that if all factories produce at once, they still don't get stuck. This also assumes limiting cyborg engineers (otherwise it should gave been 5), but i almost never make them anyway.

Yeah, afraid I can't do that with my bot. RatBot is for high oil, and as such needs all 15 trucks. Running into a lot of strange, discouraging bugs with this thing, most of them not happening in skirmish, but only in multiplayer.