Colobot Forum - International Colobot Community

Full Version: Get PowerCell energy level
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello again. This game have some methods for get information about current battery level in bot? I want to automatize battery replace, but can't find anything about thread theme.
item.energyCell.energyLevel (or this.energyCell.energyLevel if you don't need to check other bots)

0-1 for PowerCells, 1-100 for NuclearCells

Example:
Code:
object bot = radar(someotherbot);
if (bot.energyCell.energyLevel == 0)
{
   replacebattery(bot);
}
if(this.energyCell.energyLevel < 0.2)
{
   gochargeyourself();
}
(04-06-2017, 12:47 PM)tomangelo Wrote: [ -> ]0-1 for PowerCells, 1-100 for NuclearCells
I'm pretty sure that's wrong. .energyLevel is always 0-1. You can use .category to check the type.

The 0-1, 1-100 thing is only for power= in level files.
Is it documented anywhere? I just checked and couldn't find any SatCom pages that describes object's parameters like energyLevel or shieldLevel.
@RaptorParkowsky It's in the documentation for "object" variable type
(04-06-2017, 02:22 PM)krzys_h Wrote: [ -> ]
(04-06-2017, 12:47 PM)tomangelo Wrote: [ -> ]0-1 for PowerCells, 1-100 for NuclearCells
I'm pretty sure that's wrong. .energyLevel is always 0-1. You can use .category to check the type.

The 0-1, 1-100 thing is only for power= in level files.

Oh, maybe you're right. I had mistake scene syntax with cbot syntax.