This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
crameep's profile picture

OpenCCSensors and Tanks

Started by crameep, 05 April 2013 - 05:49 AM
crameep #1
Posted 05 April 2013 - 07:49 AM
So, i have OCS i want to do something ilke in this video but…. i am completly lost on how to do it


http://www.youtube.com/watch?v=tftCfDbBBAg

I know how to retrive the capacity and amounts of the tank I want but how do I make this graph.
OmegaVest #2
Posted 05 April 2013 - 10:27 AM
EDIT:
Ignore anything you might have read here before. I'd ask this particular reply removed, but it would be a waste, because I might have some help in a moment.
Lyqyd #3
Posted 05 April 2013 - 12:31 PM
You could PM Mikeemoo on these forums and ask if he has the source handy. Otherwise, it's a pretty simple matter of using the tank's capacity and amount values as well as the screen size to determine how many lines to color whatever color you choose.
PixelToast #4
Posted 05 April 2013 - 04:10 PM
you have to use some weird maths and for loops, basically you do this:

-- insert term.redirect somewhere
local Mx,My=term.getSize()
local graph_height=math.floor(My*(liquid/max_liquid))
rendering the graph itself sould be pretty easy
Lyqyd #5
Posted 06 April 2013 - 06:31 AM
Ideally, one should use `amount * maxY / capacity`.