Advertisement
Guest User

test

a guest
Aug 27th, 2014
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.97 KB | None | 0 0
  1. --while true do
  2. --  maintank = tableInfo[1]
  3. --  rawPer = maintank.amount/maintank.capacity
  4. --  pPercent = math.floor((rawPer*100)+0.5)
  5. --  print(pPercent)
  6. --  sleep(1)
  7. --end
  8.  
  9. local title = "Mob Essence Tank"
  10.  
  11. --Center Text Function
  12.   function centerText(text,yVal)
  13.     length = string.len(text)
  14.     minus = math.floor(22-length)
  15.     x = math.floor(minus/2)
  16.     mon.setCursorPos(x+1,yVal)
  17.     mon.write(text)
  18.   end
  19.  
  20. --Wraps the Peripherals
  21.   cube = peripheral.wrap("rcirontankvalvetile_4")
  22.   mon = peripheral.wrap("monitor_0")
  23.  
  24. --Sets the BackGround to White    (Messy!  I know!)
  25.   function clearScreen()
  26.     mon.clear()
  27.     mon.setBackgroundColour(colors.black)
  28.     mon.setCursorPos(1,1)
  29.     mon.write(string.rep(" ",36))
  30.     mon.setCursorPos(1,2)
  31.     mon.write(string.rep(" ",36))
  32.     mon.setCursorPos(1,3)
  33.     mon.write(string.rep(" ",36))
  34.     mon.setCursorPos(1,4)
  35.     mon.write(string.rep(" ",36))
  36.     mon.setCursorPos(1,5)
  37.     mon.write(string.rep(" ",36))
  38.     mon.setCursorPos(1,6)
  39.     mon.write(string.rep(" ",36))
  40.     mon.setCursorPos(1,7)
  41.     mon.write(string.rep(" ",36))
  42.     mon.setCursorPos(1,8)
  43.     mon.write(string.rep(" ",36))
  44.     mon.setCursorPos(1,9)
  45.     mon.write(string.rep(" ",36))
  46.     mon.setCursorPos(1,10)
  47.     mon.write(string.rep(" ",36))
  48.   end
  49.  
  50.   clearScreen()
  51. --Centers and Displays Title On Monitor
  52.   mon.setTextColour(colors.red)
  53.   mon.setTextScale(0.5)
  54.   mon.setCursorPos(0,0)
  55.   centerText(title,1)
  56.  
  57. while true do
  58.  
  59.  mon.setTextScale(2)
  60.     local tableInfo = cube.getTankInfo("south")
  61.     maintank = tableInfo[1]
  62.     --Variables for Calculations
  63.     maxE = maintank.capacity
  64.     curE = maintank.amount
  65.     rawPer = curE/maxE
  66.     percent = math.floor((rawPer*100)+0.5)
  67.     bar = math.floor((rawPer*34)+0.5)
  68.    
  69.     mon.setBackgroundColour(colors.black)
  70.     mon.setTextColour(colors.cyan)
  71.     centerText("Current: "..curE.." Mb",3)
  72.     mon.setTextColour(colors.lime)
  73.     centerText(percent.."% Full",6)
  74.  
  75. sleep(1)
  76. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement