• Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
Welcome to OpenComputers

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more!

This message will be removed once you have signed in.

  • Announcements

    • Lizzy Trickster

      Latest Stable OpenComputers Version   11/26/16

      The latest released version of OpenComputers is version 1.6.1 for MC 1.7.10, 1.8.9, 1.9.4 & 1.10.2. See more information here! Beta/Dev builds can be found at the Jenkins Build Server (ci.cil.li)
Nexarius

Tank Display Program

29 posts in this topic

This program can display the contents of tanks on a big screen with a colored bar that can dynamically change its size.
It can show up to 64 different liquids which are sorted from highest amount to lowest.
5x8 is the optimal size for the screen.
Multiple tanks with the same liquids are automatically added together and empty tanks are ignored.

This display is split into 2 programs.

1) Server - this receives the tank information and displays it

2) Client - this has the adapter with the tank controller (you can have as many as you like)

gQ5rL3X.gif

dl1WOE5.png

optimal screen sizes: 8x5; 8x2; 4x1

pastebin run -f cyF0yhXZ

installation guide:

https://www.youtube.com/watch?v=avvYO2xSxGw

github: https://github.com/Nex4rius/Nex4rius-Programme/tree/master/Tank#start

server / display components:

  • Internet Card (to install)
  • Network Card
  • Graphics Card T3
  • Screen T3

client / adapter + tank components:

  • Internet Card (to install)
  • Network Card
  • Adapter + Tank Controller Upgrade

Share this post


Link to post
Share on other sites

Update to 1.4

- increase max amount of liquids from 32 to 64

- dynamically change width of the bars

- decrease update frequency with low tps (this thing)

- added colors for lots of new liquids (especially gregtech liquids)

 

I changed the picture from my first post to a gif thats cycling through 8 pictures so you can better see how it works.

Share this post


Link to post
Share on other sites

Hello,

Since transposers are cheaper than adapters with tank controllers in the pack I am using I've went into the client program files and edited the for loop to look for "transposer". The program works perfectly however I am seeing 5x the amount of liquid and max liquid on the server screen. Is there a fix? 

Thank you!

EDIT I've found the reason. It was due to ender IO ender fluid pipes connected to all the tanks which were adjacent to some of the transposers. The ender fluid pipes seem to be perceived by each transposer as a collections of all the tanks they are connected to. This is actually practical, using this one only needs one (computer/client/transposer/adapter) for an unlimited amount of tanks ^^

Share this post


Link to post
Share on other sites

I didn't even know transposers existed because I stopped searching once I found the adapter + tank controller. I've changed it now to work with transposers and adapters at the same time.

 

The enderio ender fluid conduit trick is pretty neat.

Share this post


Link to post
Share on other sites

I would love to implement your GUI for my StockMonitor program (https://github.com/xilni/StockMonitor/tree/feature/gui for the branch I'm working on at the moment). At the moment I have a very rudimentary text only table GUI with minor color usage.

It tracks not only items and fluids in your ME network but also allows you to toggle signals to turn production and/or gathering (I use bundled cables from ProjectRed and RFTools redstone transmitters/receivers to send the signals around.

What I have in mind is instead of each bar being:

Current amount / Tank Capacity

it would be:

Current amount / Lower threshold amount / Upper threshold amount

Now where I would appreciate your advice/help is the following areas:

  1. My design would have three sections per bar instead of two. The reasons for this are important in the pack on my server (Revolution3) as it is based around Rotarycraft where power is not quite as granular as an RF based pack. With the way Rotarycraft power is on or off and not in between it saves me a lot of power to have the system work with a lower threshold and upper threshold and do work in large batches instead of constantly turning on and off as it straddles on a single threshold because I used a trickle of an item.
  2. I would obviously pull data from the ME system instead of individual computers which I have no problems doing (the existing version of StockMonitor does this well) but I'm having problem because of problem 3.
  3. While Lua is Lua, your variables are all in German I assume which has made it very hard for me to decipher which functions do what inside your repository.

Please let me know if you need any clarifications (I can try to make mockups if need be) or if any of these are areas you can assist me in, or even if you have random feedback on my program.

Share this post


Link to post
Share on other sites

I guess you could start from L135 anzeigen(tankneu). tankneu is all the information about all liquids already added together and anzeigen is looping through the table and decides the position on the display and on L177-L185 it is giving it to zeigeHier([...stuff...]) label (visible liquid name), name (hidden liquid name, this will be used to check with the color table), menge (amount), maxmenge (max amount), prozent (percent, this is calculated and not in tankneu).

zeigeHier combines the variables into the message for the screen, changes the color and then writes to the screen.

You could probably start by making a table like this for anzeigen(tankneu)

tankneu = {
{name="water", label="water", menge=1000, maxmenge=2000, somethingnewhere=500},
{name="lava", label="lava", menge=4000, maxmenge=5000, somethingnewhere=1000},
}

After that add somethingnewhere to L185 into zeigeHier and then change zeigeHier in L205 to include somethingnewhere and then change the table.inserts to have it too. There are two different messages shown if breite==40 (It means width==40) because there isn't enough space left and I decided to not show max amouint anymore on a width of 40 otherwise its too big and doesn't fit.

You will have to add anything new to farben.lua to get the colors. https://github.com/Nex4rius/Nex4rius-Programme/blob/master/Tank/server/tank/farben.lua

Share this post


Link to post
Share on other sites

Thank you for the help, so first thing I've done is attempted to translate the variable, method and parameter names in anzeige.lua to english passing each word I didn't understand through Google Translate. The result is here: https://pastebin.com/x7E2ySm1

16 hours ago, Nexarius said:

You could probably start by making a table like this for anzeigen(tankneu)

tankneu = {
{name="water", label="water", menge=1000, maxmenge=2000, somethingnewhere=500},
{name="lava", label="lava", menge=4000, maxmenge=5000, somethingnewhere=1000},
}

I appreciate you helping me decipher the data structure, I was having problems figure out what dazu and hier did in the multiple assignment on line 42 and whether they were important given I'm replacing the entire networking section that uses event.pull.

16 hours ago, Nexarius said:

After that add somethingnewhere to L185 into zeigeHier and then change zeigeHier in L205 to include somethingnewhere and then change the table.inserts to have it too. There are two different messages shown if breite==40 (It means width==40) because there isn't enough space left and I decided to not show max amouint anymore on a width of 40 otherwise its too big and doesn't fit.

I see what you mean, there's a shorter message for when the board starts to get crowded. I'm more concerned with how one would even represent three values on a bar given that the actual amount has to surpass the upper threshold before the system shuts down production (see the logic here for how it decides when to turn on and off the production). It's not as simple as current amount over capacity where 0 ≤ amount ≤ capacity which makes sense in the context of a bar.

EDIT: Does this forum have an inline code block formatting? Sometimes I don't want to create a large paragraph block for a few random code words.

Share this post


Link to post
Share on other sites

The translation looks pretty good.

hier: is easy it checks whether or not the event.pull() reached the timeout or got a message. On timeout it skips everything and displays a message that there is no available data to display.
dazu: It first checks if the id is already known and then replaces all the information with the new message and then sets dazu = false to prevent adding it at L56. (If you get the second message from the same computer you have to deal with the fact that you still have the first message and it has to be overwritten or deleted.)

If you get infromation only from the me system then you don't need update() at all. You only need if component.isAvailabe("MeSomething") then dostuff() else nodata() end

I don't think that amount > capacity would be a big problem. It will just display percent > 100% and the bar will be filled completly.

6 hours ago, xilni said:

EDIT: Does this forum have an inline code block formatting? Sometimes I don't want to create a large paragraph block for a few random code words.

idk

Share this post


Link to post
Share on other sites
12 hours ago, Nexarius said:

I don't think that amount > capacity would be a big problem. It will just display percent > 100% and the bar will be filled completly.

I think you've solved my whole crisis of what to do.

So you're suggesting I use the lower threshold as the "capacity" in this case so that anything  >= lower threshold is "full" bar. 

Since the upper threshold is merely a value I use to prevent the system from constantly toggling on and off so I don't care if it's not displayed but I do need to find a place to display whether the system for that particular item/fluid is on or off. It can work off adding a boolean "running" value to the tank data structure or something of the likes but I do want to be able to view it on the GUI at a glance. Any UI suggestions on this point?

Share this post


Link to post
Share on other sites
On 17.6.2017 at 7:30 PM, xilni said:

I think you've solved my whole crisis of what to do.

So you're suggesting I use the lower threshold as the "capacity" in this case so that anything  >= lower threshold is "full" bar. 

Since the upper threshold is merely a value I use to prevent the system from constantly toggling on and off so I don't care if it's not displayed but I do need to find a place to display whether the system for that particular item/fluid is on or off. It can work off adding a boolean "running" value to the tank data structure or something of the likes but I do want to be able to view it on the GUI at a glance. Any UI suggestions on this point?

I thought more about the upper threshold as capacity otherwise all bars will be at 100% all the time because its always producing to keep everything above 100%.

You could do something pretty simple and just change the label to have something like "Water (On)" and give that to anzeigen(tankneu) (btw color works over name not label).

Share this post


Link to post
Share on other sites

Hello .. Nice program :) but got a little bug with the client. it shows only 1% of full storage even if the drum/tank is full. on the server its shown correctly.

and got a question. possible to setup the server with higher resultion? if you only use a small 1x3 Monitor its kinda hard to read the content if you have only a few liquids.

Share this post


Link to post
Share on other sites
3 hours ago, Ranub1s said:

Hello .. Nice program :) but got a little bug with the client. it shows only 1% of full storage even if the drum/tank is full. on the server its shown correctly.

and got a question. possible to setup the server with higher resultion? if you only use a small 1x3 Monitor its kinda hard to read the content if you have only a few liquids.

Thanks :)

I only really concentrated on the display of the server and never noticed that on the client because I only used it as debug view to see the names of the fluids. The percent calculation was switched up. It was capacity / amount not amount / capacity.

I've optimised it for a big screen 8x5 http://i.imgur.com/E4N2qat.png
The resolution is already on maximum the screens cannot give more.

But do you mean something like this?

dsTU4np.png

Share this post


Link to post
Share on other sites
21 hours ago, Nexarius said:

Thanks :)

I only really concentrated on the display of the server and never noticed that on the client because I only used it as debug view to see the names of the fluids. The percent calculation was switched up. It was capacity / amount not amount / capacity.

I've optimised it for a big screen 8x5 http://i.imgur.com/E4N2qat.png
The resolution is already on maximum the screens cannot give more.

But do you mean something like this?

Yes,
and i have figured out that "server-side" print message of the liquids can only be done on 1 Monitor. So next question would be, is it possible to broadcast it to more seperated monitors in a Network thats seperated from the incomming message of the client. (example on screen)

*dont want to botch your programm :D*

2017-08-09_11.16.29.png

Share this post


Link to post
Share on other sites

Update to 1.8

-added support for multiple sceens (but sadly it will flicker when the gpu is switching to the next screen; anyone got ideas for that?)
-added support for more screen sizes (optimal is 8x5; 4x1; 8x2)
-added client will ask for wireless range on startup (default 400)

dl1WOE5.png

__________________________________________________________________________________________________

 

You have 3 liquids on the screen that are unknown to my program and thats the reason why they are all grey. If you want colors you can help me here and I will add them to this program.

This will be helpful for that.
gyjs9mW.png

And those are all colors.
oc-256-color.png

 

I have never tested it but there shouldn't be anything in the code that prevents you from making 2 servers with a screen each that will get the information from the clients.

 

 

edit:

Update 1.8.1
-fixed flckering with multiple screens :)

Share this post


Link to post
Share on other sites

Great Work !! :)

and so quick ;) thanks.
sadly i found a strange bug in spreading informations over more monitors, a few gets only strange informations. (half of text and wrong colors)
(NVM- the bug happens if you work with a Power-Distributor and a Relay)

and the wireless broadcast (with a setting of 2000range) cant reach a server (chunkloaded) which is further away (arround 500blocks)

Ah, and the liquids you see here are from "tinkers" so maybe thats why they are unknown to your program. (just took them as test)

 

 

Share this post


Link to post
Share on other sites
  • and next point i have figured out. the programs run smoothly but wont be saved on the mc-server. or the autorun.lua is bugged. after restart of the pc the program is gone/not working until you reinstall it

Share this post


Link to post
Share on other sites
22 hours ago, Ranub1s said:

Great Work !! :)

and so quick ;) thanks.
sadly i found a strange bug in spreading informations over more monitors, a few gets only strange informations. (half of text and wrong colors)
(NVM- the bug happens if you work with a Power-Distributor and a Relay)

and the wireless broadcast (with a setting of 2000range) cant reach a server (chunkloaded) which is further away (arround 500blocks)

Ah, and the liquids you see here are from "tinkers" so maybe thats why they are unknown to your program. (just took them as test)

 

2017-08-11_17.57.34.png

 

20 hours ago, Ranub1s said:
  • and next point i have figured out. the programs run smoothly but wont be saved on the mc-server. or the autorun.lua is bugged. after restart of the pc the program is gone/not working until you reinstall it

The wireless range is limited in the opencomputers config too.
I've been playing almost exclusivly on modpacks with gregtech and there are almost none with tinkers construct so I didn't have any chance to add them.I tested my program by repeatedly pressing the turn on / off button and it always booted into my program.
Can you write "edit /autorun.lua" and check whats in that file? Furthermore what is your OpenOS version? I'm running on 1.6.7. You can run this program of mine "pastebin run -f icKy25PF" to update OpenOS.

I have no idea how that white display happend. Maybe someone has some ideas why it was happening?

Share this post


Link to post
Share on other sites

Currently we are using OpenComputers-MC1.7.10-1.6.2.12-universal.
and as i already wrote:
" (NVM- the bug happens if you work with a Power-Distributor and a Relay) "

in Single player the files are working fine, even if you reboot the pc or turn it on/off .. but strangly not on our mod-pack server.
maybe with latest version a bug appeared .. the autorun.lua looks legit... but after restart the pc automaticly goes to directionary /home #

e61afd-1502533256.png


91979c-1502533224.png

Share this post


Link to post
Share on other sites

The autorun.lua looks to be ok.

Normally any error that occurs will be printed to the screen but its hidden for autorun. I looks to me like an error occured and then it just goes on as usuall as if nothing happend.

If you launch the program again then it should print any errors to the screen. Can you do that? Just write "tank", "/autorun.lua" or "/tank/anzeige.lua"

I have a relay and a power distributor connected in my test world and I'm not seeing any changes.

 

Update: 1.8.3
-added autorun will write any errors messages now

Share this post


Link to post
Share on other sites

hmmm .. have reinstalled the program as client ,... same issue after reboot/ on/off. no error .. nothing ... just beeing in diractionary /home

ah... may i mention that this happens mainly to only the client.

Share this post


Link to post
Share on other sites

maybe he doesnt start through cuz the client doesnt save the "range-settings" and abborting the autorun.lua .. cant tell for sure since no error appears

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now