Space Engineers

Space Engineers

Battery Status Script V.1.1 [Vanilla] - Lightwolf Adventures
167 Comments
V_V1P3R_V 29 Aug, 2024 @ 9:53pm 
@SWeaver
Could you do the Hydrogen one as well?
Star 3 Mar, 2024 @ 6:48pm 
unofficial update version https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=1687643514
working as of March 2024
L 6 Jan, 2024 @ 8:47pm 
plz update i love this script very helpful
NorimaR 6 Jan, 2024 @ 10:10am 
not work
Program(1349,23): Error: 'IMyTextPanel' ***
Program(1351,23): Error: 'IMyTextPanel' ***
Captain Lone Wolf 29 Dec, 2023 @ 3:06pm 
Grüße, heller Wolf, das Batteriestatusskript V.1.1 ist jetzt veraltet
Boom111222 17 Dec, 2023 @ 12:21pm 
Just to keep this at the top for people looking, Use Coffin Dodgers solution to fix the first error, and then to fix the obsolete error use IsrA's solution. BIG THANKS to both of them for their solutions.
Graeme 11 Dec, 2023 @ 9:41am 
Tried Coffin Dodgers solution, get a new error message now about 332,15 and 333,15 saying my batterybloackonly regharge is obsolete, use chargemode instead. no idea what that means..!!
stunter740 26 Nov, 2023 @ 12:02am 
for someone who doesnt understand scripts this doesnt work pls update the script .. i should be able to upload it to a programable block and then run it with very little changes
CelticDaemon 26 Oct, 2023 @ 6:42am 
Mod works fine if you follow the isntructions for the LCD screens and make the adjustments to the script as per the instructions below from CoffinDodger and Isra. Bit of a pain but heh, it works.
L. Asmodeus 14 Oct, 2023 @ 10:10am 
Same problem here, hope it get fixes soon by the developer
AH-64Delta 11 Oct, 2023 @ 1:49am 
Yeah, as HerzogVanRossman said, I am getting that same error as well. Maybe keen has changed some things?
🐾Hyperiol🐾 25 Sep, 2023 @ 1:00pm 
When I try to compile it, it gives me this error:

Program(1349,23): Error: 'IMyTextPanel' does not contain a definition for 'ShowPublicTextOnScreen' and no accessible extension method 'ShowPublicTextOnScreen' accepting a first argument of type
'MyTextPanel' could be found (are you missing a using directive or an assembly reference?)
Program(1351,23): Error: 'MyTextPanel' does not contain a definition for 'WritePublicText' and no accessible extension method 'WritePublicText' accepting a first argument of type 'MyTextPanel' could be found (are you missing a using directive or an assembly reference?)
RuskyNineNine 15 Sep, 2023 @ 7:32pm 
first time running an in-game script in any of my worlds, have been looking to get something like this running for a long time, took a bit of playing around, some delving into the comments and a good few youtube videos but I eventually got the script running, looks wicked, works great, thanks heaps

thanks aswell to CoffinDodger and IsrA, I had no idea how to interperate those error codes, would have just had to keep scrolling through the workshop looking for a different script without your insight
SiderealPlague 12 Sep, 2023 @ 8:08am 
Hey I was wondering if there was any way to make this work on a cockpits LCD? Any help would be appreciated.
CoffinDodger 10 Sep, 2023 @ 6:13am 
As well as the changes posted by IseA below, you now need to go to the end of the script and make it look like this:


BatteryStatus_Lcd_X.SetValue("FontColor", new Color(LCDbright,LCDbright,LCDbright)); // White
BatteryStatus_Lcd_X.SetValue("FontSize", 0.10f); // set Font size of your LCD
BatteryStatus_Lcd_X.SetValue("Font", (long)1147350002);
//BatteryStatus_Lcd_X.ShowPublicTextOnScreen();
//BatteryStatus_Lcd_X.WritePublicText("", false);
BatteryStatus_Lcd_X.WriteText("" + str_AllBoundlis_001_To_178, false);
}
}
}// End of Main script
Swiftie 8 Sep, 2023 @ 10:49pm 
Seems to be broken since the newest update. I get a "assembly not found please compile script" error whenever trying to run it.
Teddy 8 Jul, 2023 @ 1:08pm 
jo dein skipt mag nicht mehr laufen hab es mir auch erst gestern geholt kurz gegangen und seit heut schreit es laut nein keine lust mehr wen lieb wen du es updaten würdes auf die neuesten versonen :steamthumbsup:
IsrA 22 Mar, 2023 @ 9:42am 
and no worries with deprecate code. It will compile anyway.
IsrA 22 Mar, 2023 @ 9:41am 
To fix the obsolete things, replace with this part. I'm not an expert but it works.



bool batt_IsFunctional = false;
bool batt_IsCharging = false;
bool batt_OnlyRecharge = false;
bool batt_OnlyDischarge = false;
bool batt_IsOff = false;

ChargeMode batt_state_recharge=ChargeMode.Recharge;
ChargeMode batt_state_discharge=ChargeMode.Discharge;

if (batterylist_X.Enabled) {
batt_IsOff = true;
if (batterylist[i].IsFunctional) {
if (batterylist[i].IsWorking) {
batt_IsFunctional = true;
if (batterylist_X.IsCharging) { batt_IsCharging = true; }
else if (batterylist_X.ChargeMode==batt_state_recharge){ batt_OnlyRecharge = true; }
else if (batterylist_X.ChargeMode==batt_state_discharge){ batt_OnlyDischarge = true; }
//else if (batterylist_X.OnlyDischarge) { batt_OnlyDischarge = true; }
}}} else if (batterylist[i].IsFunctional) { batt_IsFunctional = true; }
xxx.514 17 Mar, 2023 @ 2:22pm 
He.. Hello? May I get gold shovel for diggin up ancient thing? Tryied to check this nice chunk of code but after 5 years of game development programmable block throws errors about obsolete things (line 332, 333 - IMyBatteryBlock.Only* says to change to 'ChargeMode', 1349 and 1351 IMyTextPanel.WritePublicText{string, bool} as depracted). I'll try to learn at your script If you allow, however maybe You will be faster of correcting it. Anyway thanks for such pprecious thing.
3dfxorchid 11 Dec, 2022 @ 1:42am 
Könntest du dein video auch auf deutsch machen, Bitte!! und was bedeutet der Pfeil hoch aufm LCD bei einer Batterie??
RakWar 29 Jul, 2022 @ 4:14pm 
Simplexxity they are in the script area and not the mod area .. search Utube and do a search on "space engineers how to enable scripts" easy to do just need to know where to find the button to enable them and then they will appear
RakWar 29 Jul, 2022 @ 4:12pm 
thank you for sharing
Simplexxity 19 Jul, 2022 @ 10:11am 
ok so im new to space engineers with the lcd stuff, where do I find the script
[ZD] Jobey 24 Mar, 2022 @ 10:49am 
If you read the message you get when you compile you will see its an warning NOT an error, the script works fine and compiles
Trindle 19 Mar, 2022 @ 9:55pm 
Works perfectly fine for me
Tkonian 15 Mar, 2022 @ 1:08pm 
Re post by GimpVet: Same here, will not compile.
Kloud77 4 Feb, 2022 @ 1:42pm 
Seems to be not working, caught exception referencing a block, or similar, won't run for me.
BloodyFinger 4 Jan, 2022 @ 9:59am 
Can you pls update this on?
Missath 22 May, 2021 @ 9:26pm 
Super useful. Is there any way to show the name of the battery? So that we can know which battery is in what status? Specially for when we connect vehicles to the base
[I.L]Methidox 16 Jan, 2021 @ 10:44pm 
i've had no luck running this on small grid. is it possible to set the script to such. would be great to keep an eye on my battery status in a small grid ship on the go
ChozoSR388 11 Nov, 2020 @ 9:10am 
@ArrivvA That would be amazing if it does. Come to think of it, I wonder if it'll run on the small grid corner LCDs
thorusderwolf 29 Aug, 2020 @ 6:52am 
leider funzt der mod in der aktuellen version nicht mehr. schade ansich
ArrIvvA 28 Aug, 2020 @ 1:21pm 
will it run on cockpit lcd?
armablign 25 Aug, 2020 @ 1:50am 
Where is the string/line located where the strong/text is that describes the title? ("Battery Status")
(I want to add a custom title)
Khadrim 24 May, 2020 @ 3:27am 
It's good but once you get over 100 batteries it doesn't seem to support splitting the display over multiple screens?
Mako 27 Apr, 2020 @ 9:21am 
This does not appear to work any loner. Has a lot of exceptions when compiling.
SavedByChrist 1 Apr, 2020 @ 9:16am 
won't run on the programmable Block's LCD. works on regular LCDs
Uniform300 23 Mar, 2020 @ 2:48pm 
Help I want a good battery status script but this one says "exception caught" and wont run
TafaleZ 20 Mar, 2020 @ 11:17am 
been good script but broken now
WDForty 18 Feb, 2020 @ 8:12pm 
I was using this script in my game, and found some oddities with it. If you have have it set to only show tagged batteries, but have more than 20 batteries in your system, it will show small icons, even though you only have tagged less (e.g. 2). After some time poking around the code, I was able to make some changes to force the larger icons when I have fewer than 20 tagged batteries.

For anyone interested in how I solved this, on line 189, I changed "battAmountCount = 0;" instead of the grid's total number of batteries (batterList.Count);, then before line 200 I added a loop that counted the number of tagged batteries:

for (int i=0; i<batterylist.Count; i++)
{
if (OnlyBatteryWithNameTag) {
if (batterylist .CustomName.Contains(BatteryNameTag)) {
battAmountCount +=1; }
}
}

If you later decide you don't want to show tagged batteries only, I'm not sure, but you might want to undo the code changes.
DMOrigin 20 Jan, 2020 @ 3:27pm 
Has you tried it correctly? I'm testing it currently, and it works well. However, both versions are no longer being developed. However, there is a replacement. More about this will be available when the time comes, on the page of my version.
Tiger 19 Jan, 2020 @ 7:15am 
DMOrigin's rewrite/patch throws no errors, but outputs nothing either
Tiger 18 Jan, 2020 @ 3:26pm 
Completely broken as of the current game version
Nirahiel 25 Dec, 2019 @ 9:38am 
I'd like to know how you do this, I want to make my own fancy LCD display script
Pegas519 23 Dec, 2019 @ 5:58pm 
I do too, caught exception during execution of script (as per Magnusnordic's post below). This was introduced with the new holiday update. I would appreciate if you would update please.
Magnusnordic 15 Sep, 2019 @ 7:11am 
hello i get an error with script in space it says "Caught exception during execution of script:Index was outside the bounds of the array. at Program.(Ylain[String argument, UpdateType updateSource) at Sandbox.Game.Entities.Blocks.MyPr ogrammableStock.oc Display:las s4 6_0 .<ExecuteCode>b IfYlyGridP rogram program)

at Sandbox.Game.Entities.Blocks.MyPr ogrammableBlock.RunSandboxedPro gramRction(Rction'l action, Strings response]

"
help
Dots 6 Aug, 2019 @ 8:08am 
this script was revolutionary when it came out but now is dead and the so called fix only makes it work but not optimized. Script causes lagg and sim speed drops on lower end systems on current game builds.
Spartan 22 Jul, 2019 @ 12:18am 
Take your time buddy, modding spends a lot of our free time :)