Colobot Forum - International Colobot Community
Get PowerCell energy level - Printable Version

+- Colobot Forum - International Colobot Community (https://colobot.info/forum)
+-- Forum: [Archive] New forum (2015-2019) (https://colobot.info/forum/forumdisplay.php?fid=76)
+--- Forum: Colobot: Gold Edition Basics (https://colobot.info/forum/forumdisplay.php?fid=58)
+---- Forum: Help (https://colobot.info/forum/forumdisplay.php?fid=61)
+---- Thread: Get PowerCell energy level (/showthread.php?tid=921)



Get PowerCell energy level - lexofein - 04-06-2017

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.


RE: Get PowerCell energy level - tomangelo - 04-06-2017

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();
}



RE: Get PowerCell energy level - krzys_h - 04-06-2017

(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.


RE: Get PowerCell energy level - RaptorParkowsky - 04-06-2017

Is it documented anywhere? I just checked and couldn't find any SatCom pages that describes object's parameters like energyLevel or shieldLevel.


RE: Get PowerCell energy level - krzys_h - 04-06-2017

@RaptorParkowsky It's in the documentation for "object" variable type


RE: Get PowerCell energy level - tomangelo - 04-06-2017

(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.