Advertisement
Guest User

tank.lua

a guest
Jan 31st, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.84 KB | None | 0 0
  1. sideTank = "right"
  2. delay = 5
  3.  
  4. myTimer = os.startTimer(1)
  5.  
  6. while true do
  7.   local event, timerID = os.pullEvent("timer")
  8.   if timerID == myTimer then
  9.     term.clear()
  10.     term.setCursorPos(1, 1)
  11.    
  12.     if peripheral.isPresent(sideTank) == true then
  13.       local tank = peripheral.wrap(sideTank)
  14.       local info = tank.getTankInfo(sideTank)
  15.       local data = info[1]
  16.  
  17.       if (tostring(data['rawName']) ~= "nil") then
  18.         --print(tostring(data['rawName']).." ["..tostring(data['name']).."] ("..tostring(data['id'])..")")
  19.         --print(tostring(data['amount']).." / "..tostring(data['capacity']))
  20.         print(tostring(data['amount']).." / ")
  21.         print(tostring(data['capacity']))
  22.       else
  23.         print("Empty!")
  24.       end    
  25.  
  26.     else
  27.       print("Empty!")
  28.     end
  29.    
  30.     myTimer = os.startTimer(delay)
  31.   end
  32. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement