Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mon = peripheral.wrap("monitor_10")
- power1 = peripheral.wrap("draconic_rf_storage_6")
- power2 = peripheral.wrap("draconic_rf_storage_7")
- power3 = peripheral.wrap("draconic_rf_storage_8")
- power4 = peripheral.wrap("draconic_rf_storage_9")
- local maxpower1 = 0
- local maxpower2 = 0
- local maxpower3 = 0
- local maxpower4 = 0
- local maxpower = 0
- local curpower1 = 0
- local curpower2 = 0
- local curpower3 = 0
- local curpower4 = 0
- local curpower = 0
- local perpower = 0
- monX, monY = mon.getSize()
- local length = 0
- function checkPower()
- maxpower1 = power1.getMaxEnergyStored()
- maxpower2 = power2.getMaxEnergyStored()
- maxpower3 = power3.getMaxEnergyStored()
- maxpower4 = power4.getMaxEnergyStored()
- curpower1 = power1.getEnergyStored()
- curpower2 = power2.getEnergyStored()
- curpower3 = power3.getEnergyStored()
- curpower4 = power4.getEnergyStored()
- maxpower = maxpower1+maxpower2+maxpower3+maxpower4
- curpower = curpower1+curpower2+curpower3+curpower4
- perpower = math.floor((((curpower)/(maxpower))*100)+0.5)
- end
- function writemon()
- mon.setBackgroundColor(colors.black)
- mon.clear()
- mon.setCursorPos(1,1)
- -- mon.write("power")
- header =" Draconic Evolution "
- centerT(header, 1, colors.lightGray, colors.blue)
- title = " Energie: "..perpower.."% Voll "
- centerT(title, 2, colors.lightGray, colors.blue)
- mon.setCursorPos(2,1)
- jetztE = "Jetzige Energie: "..(curpower).."RF "
- centerT(jetztE, 3, colors.lightGray, colors.blue)
- mon.setCursorPos(3,1)
- maxE = "Maximale Energie: "..(maxpower).."RF "
- centerT(maxE, 4, colors.lightGray, colors.blue)
- end
- function centerT(texty, liney, backColor, txtColor)
- mon.setBackgroundColor(backColor)
- mon.setTextColor(txtColor)
- length = string.len(texty)
- dif = math.floor(monX-length)
- x = math.floor(dif/2)
- mon.setCursorPos(x+1,liney)
- mon.write(texty)
- end
- function drawBar()
- bar = math.floor(((curpower/maxpower)*(monX-2))+0.5)
- mon.setCursorPos(2,monY-2)
- mon.setBackgroundColor(colors.lightGray)
- mon.write(string.rep(" ", monX-2))
- mon.setCursorPos(2, monY-3)
- mon.setBackgroundColor(colors.lightGray)
- mon.write(string.rep(" ",monX-2))
- mon.setCursorPos(2, monY-2)
- mon.setBackgroundColor(colors.red)
- mon.write(string.rep(" ", bar))
- mon.setCursorPos(2, monY-3)
- mon.setBackgroundColor(colors.red)
- mon.write(string.rep(" ", bar))
- end
- while true do
- checkPower()
- writemon()
- drawBar()
- print(curpower.."/"..maxpower)
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement