Space Engineers

Space Engineers

Not enough ratings
Simple Cargo Capacity Displayer
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
1.058 KB
17 Dec, 2016 @ 2:01pm
1 Change Note ( view )

Subscribe to download
Simple Cargo Capacity Displayer

Description
Consider the following. You have one cargo container, and you want to see how full it is without opening the menu. You stick an LCD screen down, hoping that you can see a convenient capacity bar, but nothing happens. You need to use a programming block and a book of C# to do that. This is for those people who are too lazy to do it themselves.

Put down your cargo container, LCD, programmable block and timer. Set the timer to run the programmable block every few seconds. Now go in the programmable block and add this script, and edit some of the settings at the top. Once you've done that just select all your parts and make sure they belong to you, then start up the timer.

As for what the settings you can change do:
ContainerName: The name of your cargo container
ScreenName: The name of the LCD screen
ScreenWidth: Once you set up your LCD, how many characters can you fit on the screen before it gets cut off?
Prefix: Some text to go before the progress bar
OpenChar: The character at the start of the progress bar. Leave to default if unsure
CloseChar: The character at the end of the progress bar. Leave to default if unsure
ProgressChar: The character representing the filled part of the progress bar. Leave to default if unsure
EmptyChar: The character representing the empty part of the progress bar. Leave to default if unsure
5 Comments
Menz Agitat 18 Feb, 2020 @ 2:13pm 
I dunno why I had issues with this script in 2018, it works perfectly well now.

@IGotAShotgun you could add the following lines before the public void main thingy (so at the very top of your script) in order for the LCD screen to refresh automatically without the need of any timer block:

public Program() {
Runtime.UpdateFrequency = UpdateFrequency.Update10;
}
Menz Agitat 23 Mar, 2018 @ 10:20am 
I can't seem to make this script to work.
I've named my text panel "LCD Cargo Drill" and the cargo "Large Cargo Container Drill", I've set the names accordingly in the script, recompiled it, and added a timer block that runs the programmable block every 5 sec. I've also tried to trigger manually the blocks with no avail.
Nothing displays on the text panel except the "ONLINE" text.
The programmable block doesn't show any script error when running.
Any idea would be greatly appreciated.
IGotAShotgun  [author] 15 Jan, 2017 @ 3:48pm 
If you want more bars you'll want to edit the ScreenWidth variable. It's 11 by default to fit nicely in the new halfsize screens.

ScreenWidth = Prefix length + opening bracket + bar segments + closing bracket
For 10 segments in the bar, that's:
ScreenWidth = Prefix length + 1 + 10 + 1
ScreenWidth = Prefix length + 12
If you aren't using a prefix, ScreenWidth=12 should give you 10 segments. To not use a prefix, change Prefix to "", or two double quotes with nothing between them.
MisusedPower 15 Jan, 2017 @ 12:33am 
I like it but how do you add more bars... Im useing | and I as the bars and I want to make it 10 bars 1 per 10% of cap.. for example 100% would be [||||||||||] and 50% [|||||IIIII] something like that.. making a type of ammo counter
Patrick 22 Dec, 2016 @ 6:28pm 
Thank you for making this script! I've been playing a survival world for a while, and I needed somethin to monitor how much fuel I had for my hydrogen thrusters. This works very well.