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

queuedPower()

Find out if your power reserves have gone negative, indicating that you have one or more tasks stalled due to lack of power...

 

Syntax

var power = queuedPower(player);

Parameters

ParameterTypeMandatoryDescriptionGame version
playerNumber(tick)

The player to inspect.

3.2

Return value

ValueTypeDescriptionGame version
<power>NumberA number representing the amount of power the player needs before all current production and research tasks can start.3.2
0NumberIf the function returns 0, it means that you have a positive power reserve. See notes below for more info.3.2
<error>ErrorThe player specified does not exist. There is no spoon.3.2

Notes

When you produce, build or research something, the cost of it has to be taken from your power reserves. If your power reserves are too low, the task will stall with a green progress bar while it waits for power income.

Power from derricks will be distributed to all tasks that are stalled waiting for power. As such, if you have lots of tasks (eg. several research tasks, a few factories trying to build droids, some trucks trying to build structures, etc) it could take a long time before any of them get the required power to progress to their production, building or construction phase.

For this reason, it's a good idea to check whether you have power in your reserves before starting a task. Ideally wait until there is power in your reserves (queuedPower() will be 0, playerPower() will be a positive number) before starting another task.

Example

Do I have power in my power reserves?
var powerRequired = queuedPower(me);
 
if (!powerRequired) {
	// I have power in my power reserves
} else {
	// My power reserves are empty and tasks are stalling waiting for power
}
Availability 3.1 B1+

Requires:

  • Warzone 3.1 Beta 1 or above.
Contents

Jump to:

See also

Related API features:

Â