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 | ||||||
---|---|---|---|---|---|---|
| ||||||
var power = queuedPower(player); |
Parameters
Parameter | Type | Mandatory | Description | Game version |
---|---|---|---|---|
player | Number | The player to inspect. | 3.2 |
Return value
Value | Type | Description | Game version |
---|---|---|---|
<power> | Number | A number representing the amount of power the player needs before all current production and research tasks can start. | 3.2 |
0 | Number | If the function returns 0, it means that you have a positive power reserve. See notes below for more info. | 3.2 |
<error> | Error | The 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 | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
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 | ||||||
---|---|---|---|---|---|---|
| ||||||
Availability
Requires:
|
Div | ||||
---|---|---|---|---|
| ||||
ContentsJump to:
|
Div | ||
---|---|---|
| ||
See alsoRelated API features:
|