Space Engineers

Space Engineers

评价数不足
Battery Charge Display
   
奖励
收藏
已收藏
取消收藏
文件大小
发表于
更新日期
1.512 KB
2016 年 8 月 8 日 下午 8:42
2017 年 7 月 6 日 下午 10:27
3 项改动说明 ( 查看 )

订阅以下载
Battery Charge Display

在 The BunDroid 的 1 个合集中
VI Bridge Pack
3 件物品
描述
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 条留言
MYK95 2021 年 10 月 29 日 下午 4:13 
I have the same error messages that Oppaikun had below. What lines of code should I delete for it to work?
Oppaikun 2017 年 7 月 10 日 上午 1:42 
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  [作者] 2017 年 7 月 6 日 下午 10:29 
@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 2017 年 7 月 1 日 上午 3:40 
Yay! Thanks dude - makes me so happy.
The BunDroid  [作者] 2017 年 6 月 29 日 下午 11:54 
@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 2017 年 6 月 25 日 上午 3:58 
@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  [作者] 2017 年 6 月 25 日 上午 12:20 
@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 2017 年 6 月 19 日 上午 9:51 
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  [作者] 2017 年 1 月 25 日 下午 11:09 
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 2017 年 1 月 3 日 上午 1:33 
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! :)