Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local cap1 = peripheral.wrap("left")
- local cap2 = peripheral.wrap("right")
- dsp1 = peripheral.wrap("monitor_1")
- user1OutSIR = 0
- user2OutSIR = 0
- monitorVal1 = 0
- monitorVal2 = 0
- local index = 0
- while true do
- dsp1.clear()
- dsp1.setTextScale(0.5)
- dsp1.setBackgroundColor(colors.gray)
- dsp1.setCursorPos(1,1)
- dsp1.write("Power Monitor (pay in DRC/Draconium)")
- dsp1.setBackgroundColor(colors.lightGray)
- dsp1.setCursorPos(1,2)
- dsp1.write("Price : 1 Draconium Dust / 20E6 RF ")
- dsp1.setBackgroundColor(colors.black)
- if redstone.getInput("left") then
- dsp1.setBackgroundColor(colors.lime)
- else
- dsp1.setBackgroundColor(colors.red)
- end
- dsp1.setCursorPos(1,4)
- dsp1.write("User 01 Power Counter ")
- dsp1.setBackgroundColor(colors.black)
- dsp1.setCursorPos(1,5)
- dsp1.write("Count: ")
- dsp1.write(math.floor(monitorVal1))
- dsp1.write(" Rf (")
- dsp1.write(math.floor(monitorVal1*10/20000000)/10)
- dsp1.write(" DRC)")
- if redstone.getInput("right") then
- dsp1.setBackgroundColor(colors.lime)
- else
- dsp1.setBackgroundColor(colors.red)
- end
- dsp1.setCursorPos(1,7)
- dsp1.write("User 02 Power Counter ")
- dsp1.setBackgroundColor(colors.black)
- dsp1.setCursorPos(1,8)
- dsp1.write("Count: ")
- dsp1.write(math.floor(monitorVal2))
- dsp1.write(" Rf (")
- dsp1.write(math.floor(monitorVal2*10/20000000)/10)
- dsp1.write(" DRC)")
- user1OutSIR = user1OutSIR + cap1.getAverageOutputPerTick()
- user2OutSIR = user2OutSIR + cap2.getAverageOutputPerTick()
- index = index + 1
- if index == 60 then
- dataFile = fs.open("counterstat.txt","r")
- datafromFile1 = dataFile.readLine()
- datafromFile2 = dataFile.readLine()
- monitorVal1 = datafromFile1
- monitorVal2 = datafromFile2
- dataFile.close()
- dataFile = fs.open("counterstat.txt","w")
- datafromFile1 = tonumber(datafromFile1) + user1OutSIR
- datafromFile2 = tonumber(datafromFile2) + user2OutSIR
- dataFile.writeLine(datafromFile1)
- dataFile.writeLine(datafromFile2)
- dataFile.flush()
- dataFile.close()
- index = 0
- user1OutSIR = 0
- user2OutSIR = 0
- end
- os.sleep(1/20)
- end
Add Comment
Please, Sign In to add comment