Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --while true do
- -- maintank = tableInfo[1]
- -- rawPer = maintank.amount/maintank.capacity
- -- pPercent = math.floor((rawPer*100)+0.5)
- -- print(pPercent)
- -- sleep(1)
- --end
- local title = "Mob Essence Tank"
- --Center Text Function
- function centerText(text,yVal)
- length = string.len(text)
- minus = math.floor(22-length)
- x = math.floor(minus/2)
- mon.setCursorPos(x+1,yVal)
- mon.write(text)
- end
- --Wraps the Peripherals
- cube = peripheral.wrap("rcirontankvalvetile_4")
- mon = peripheral.wrap("monitor_0")
- --Sets the BackGround to White (Messy! I know!)
- function clearScreen()
- mon.clear()
- mon.setBackgroundColour(colors.black)
- mon.setCursorPos(1,1)
- mon.write(string.rep(" ",36))
- mon.setCursorPos(1,2)
- mon.write(string.rep(" ",36))
- mon.setCursorPos(1,3)
- mon.write(string.rep(" ",36))
- mon.setCursorPos(1,4)
- mon.write(string.rep(" ",36))
- mon.setCursorPos(1,5)
- mon.write(string.rep(" ",36))
- mon.setCursorPos(1,6)
- mon.write(string.rep(" ",36))
- mon.setCursorPos(1,7)
- mon.write(string.rep(" ",36))
- mon.setCursorPos(1,8)
- mon.write(string.rep(" ",36))
- mon.setCursorPos(1,9)
- mon.write(string.rep(" ",36))
- mon.setCursorPos(1,10)
- mon.write(string.rep(" ",36))
- end
- clearScreen()
- --Centers and Displays Title On Monitor
- mon.setTextColour(colors.red)
- mon.setTextScale(0.5)
- mon.setCursorPos(0,0)
- centerText(title,1)
- while true do
- mon.setTextScale(2)
- local tableInfo = cube.getTankInfo("south")
- maintank = tableInfo[1]
- --Variables for Calculations
- maxE = maintank.capacity
- curE = maintank.amount
- rawPer = curE/maxE
- percent = math.floor((rawPer*100)+0.5)
- bar = math.floor((rawPer*34)+0.5)
- mon.setBackgroundColour(colors.black)
- mon.setTextColour(colors.cyan)
- centerText("Current: "..curE.." Mb",3)
- mon.setTextColour(colors.lime)
- centerText(percent.."% Full",6)
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement