Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Fetching Sides from File
- isset = fs.exists(".capacitordata")
- data = {}
- --Saving variables to file
- if isset == true then
- handle = assert(fs.open(".capacitordata", "r"), "Couldn't load vars")
- data = textutils.unserialize(handle.readAll())
- handle.close()
- elseif isset == false then
- handle = assert(fs.open(".capacitordata", "w"), "Couldn't load vars")
- term.clear()
- term.setCursorPos(1,1)
- term.write("Enter side of Advanced Monitor: ")
- monitorside = read()
- term.setCursorPos(1,2)
- term.write("Enter side of Capacitor Bank: ")
- capacitor = read()
- data.capacitor = capacitor
- data.monitorside = monitorside
- handle.write(textutils.serialize(data))
- handle.close()
- end
- --Wrapped monitor and Capacitor Bank as peripherals
- monitor = peripheral.wrap(data.monitorside)
- cap = peripheral.wrap(data.capacitor)
- monitor.clear()
- --Infinite loop for Dynamic Data
- while true do
- monx, mony = monitor.getSize()
- stored = cap.getEnergyStored("1")
- maxstored = cap.getMaxEnergyStored("1")
- percent = math.ceil((stored / maxstored) * 100)
- pxpl = math.ceil(mony * (percent / 100))
- print(pxpl)
- sleep(1)
- term.redirect(monitor)
- paintutils.drawLine(monx,mony,0, 0,colors.black)
- term.restore()
- monitor.clear()
- for i = 1, monx do
- term.redirect(monitor)
- paintutils.drawLine(i, mony, i, mony - pxpl, colors.green)
- term.restore()
- print(i)
- print(mony)
- print(pxpl)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement