Space Engineers

Space Engineers

Not enough ratings
Battery Charge Display
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
1.512 KB
8 Aug, 2016 @ 8:42pm
6 Jul, 2017 @ 10:27pm
3 Change Notes ( view )

Subscribe to download
Battery Charge Display

In 1 collection by The BunDroid
VI Bridge Pack
3 items
Description
The purpose of this simple script is to display the percentage charge of all batteries on the grid it runs on, and display them as both a numeral percent and a graphical bar on specified LCD screens. The primary use is to have on the bridge of a large ship, though it can work on any grid, to quickly provide the charge level of all batteries on the ship/station at a glance. Edit the code to specify which LCD panel(s) to use for display, as well as the number of posts to display per screen and the number of batteries on the grid, and the script will take care of the rest. Requires only the LCD panel as a supplementary block, and can be run on a timer.

1.01 - Altered the GUI to display a more compact fill bar, and moved the percentage to the right of the bar.
10 Comments
MYK95 29 Oct, 2021 @ 4:13pm 
I have the same error messages that Oppaikun had below. What lines of code should I delete for it to work?
Oppaikun 10 Jul, 2017 @ 1:42am 
No worries! I was out on a longer trip myself, so it was perfect :) Thanks so much - despite it just having been a faceplant and a quickn fix ;)
The BunDroid  [author] 6 Jul, 2017 @ 10:29pm 
@Tolle sorry it took me longer than I meant to to get back to you... life happened, I got busy, etc. Anyway... I dunno if you do a lot of programming but if you do... have you ever looked back at your own code and wondered exactly what you were on when you wrote it? What substance abuse produced such foolish code? Yeah, this is one example.

Anyway, the "private deprecation" error is cause LCDs used to have Public and Private displays. And to be honest... I have no idea why I was writing anything to Private text, ever. I deleted the lines of code entirely and ran it again in a test environment, and it's working now, so... I dunno. XD Whatever. It works again!
Oppaikun 1 Jul, 2017 @ 3:40am 
Yay! Thanks dude - makes me so happy.
The BunDroid  [author] 29 Jun, 2017 @ 11:54pm 
@Tolle I think I know exactly what the problem is. I'll get working on it this Sunday, as that is the first day of my weekend from work, and get a fix out ASAP.
Oppaikun 25 Jun, 2017 @ 3:58am 
@Arioth Vulpe Thank you so much :) I'm getting the following error when checking the code:


Program(64,12): Warning: 'IMyTextPanel.WritePrivateText(string, bool)' is obsolete: 'LCD private text is deprecated'
Program105,8): Warning: 'IMyTextPanel.WritePrivateText(string, bool)' is obsolete: 'LCD private text is deprecated'

It might be a simple fix, but I'm not very familiar with coding. The only thing I've edited in the script is the two instances where the name of the display is written - I've exchanged it with the name of my own display.
The BunDroid  [author] 25 Jun, 2017 @ 12:20am 
@Tolle I'd be happy to look into it. Can you tell me what errors you're running into, to help me narrow it down? Thank you!
Oppaikun 19 Jun, 2017 @ 9:51am 
Hey mate. Would love to have this script running on my station, but I'm currently getting 2 errors while running it. Something you could fix? :D I love the design and simplicity.
The BunDroid  [author] 25 Jan, 2017 @ 11:09pm 
Hello! Sorry for the late reply. You're probably 100% correct about your second point; I wrote this and my other scripts as a project to help me learn more about C# programming and SE scripting, so I'm sure there are better ways to accomplish what I have. When my replacement GPU comes in and I can run the game again, I'll see about improving this script. But as for the helping newbies understand... I'm confused. Are there not comments with a big ol' HOW TO USE paragraph? I thought I had included them; my local copy certainly has it. I'll verify in about a week to be sure, though.
peaces 3 Jan, 2017 @ 1:33am 
Hey, some helpful feedback here:
1) Help newbies understand how to use this script; write "write your LCD name here" instead of "Val.batt1".
2) you can count batteries automatically, use "blocks.Count" so user don't need to change the Constant when the add/remove batteries.
Thanks for sharing the script! :)