Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt

Find out how much power is still needed to start current production and research ordersif your power reserves have gone negative, indicating that you have one or more tasks stalled due to lack of power...

 

Syntax

Code Block
themeRDark
languagejavascript
linenumberstrue
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.

Image Added

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

Code Block
themeRDark
languagejavascript
titleDo I have power in my power reserves?
linenumberstrue
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
}
Div
classbox
Availability
Status
colourGreen
title3.1 b1+

Requires:

  • Warzone 3.1 Beta 1 or above.
Div
classbox
Contents

Jump to:

Table of Contents
maxLevel5

Div
classbox

See also

Related API features: