frosty8612

Lua ComputerCraft Openblocks Tank

May 24th, 2014
520
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.70 KB | None | 0 0
  1. m = peripheral.wrap("openblocks_tank_0")
  2. mon = peripheral.wrap("left")
  3.  
  4. -- loop so constantly updates
  5. while true do
  6.   tanksTable = m.getTankInfo("unknown")
  7.   maintank = tanksTable[1] -- gets data for tank
  8.  
  9.   -- prints all data to computer
  10.   shell.run('clear')
  11.   for k, v in pairs(maintank) do
  12.         print(tostring(k)..": "..tostring(v))
  13.   end
  14.  
  15.   -- prints only capacity/amount to monitor
  16.   mon.clear() -- resets monitor
  17.   mon.setCursorPos(1,1)
  18.   mon.write("Liquid: "..maintank.rawName)
  19.   mon.setCursorPos(1,2)
  20.   mon.write("Capacity: "..maintank.capacity)
  21.   mon.setCursorPos(1,3)
  22.   mon.write("Amount: "..maintank.amount)
  23.  
  24.   -- waits 5 seconds
  25.   sleep(5)
  26. end
  27. --pastebin get H6cCFjDR tank
Advertisement
Add Comment
Please, Sign In to add comment