Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local m = peripheral.wrap("monitor_151")
- print("Starting the program...")
- sleep(1)
- while true do
- rsleft = redstone.getAnalogInput("left")
- rsright = redstone.getAnalogInput("right")
- print("-------")
- print("Restarting the control")
- if rsleft==15 and rsright==15 then
- redstone.setOutput("top",false)
- redstone.setOutput("bottom",true)
- redstone.setOutput("back",true)
- print("-------")
- print("All Energy Cells are full")
- print("Using the Left Energy Cell")
- else
- if rsleft==0 and rsright==0 then
- redstone.setOutput("top",true)
- redstone.setOutput("bottom",true)
- redstone.setOutput("back",false)
- print("-------")
- print("No energy")
- print("Both Energy Cells are depleted")
- else
- if rsleft~=0 and rsleft ~=15 and rsright~=0 and rsright~=15 and rsleft==rsright then
- redstone.setOutput("top",false)
- redstone.setOutput("bottom",true)
- redstone.setOutput("back",false)
- print("-------")
- print("The Energy Cells have equal energies")
- print("Using the Left Energy Cell")
- else
- if rsleft~=0 and rsleft ~=15 and rsright~=0 and rsright~=15 and rsleft>rsright then
- redstone.setOutput("top",false)
- redstone.setOutput("bottom",true)
- redstone.setOutput("back",false)
- print("-------")
- print("The Left Energy Cell has greater energy than that of the Right")
- print("Using the Left Energy Cell")
- else
- if rsleft~=0 and rsleft ~=15 and rsright~=0 and rsright~=15 and rsleft<rsright then
- redstone.setOutput("top",true)
- redstone.setOutput("bottom",false)
- redstone.setOutput("back",false)
- print("-------")
- print("The Right Energy Cell has greater energy than that of the Left")
- print("Using the Right Energy Cell")
- else
- if rsleft==0 and rsright~=0 then
- redstone.setOutput("top",true)
- redstone.setOutput("bottom",false)
- redstone.setOutput("back",false)
- print("-------")
- print("The Left Energy Cell is depleted")
- print("Using the Right Energy Cell")
- else
- if rsleft~=0 and rsright==0 then
- redstone.setOutput("top",false)
- redstone.setOutput("bottom",true)
- redstone.setOutput("back",false)
- print("-------")
- print("The Right Energy Cell is depleted")
- print("Using the Left Energy Cell")
- else
- if rsleft~=15 and rsright==15 then
- redstone.setOutput("top",true)
- redstone.setOutput("bottom",false)
- redstone.setOutput("back",true)
- print("-------")
- print("The Right Energy Cell is full")
- print("Using the Right Energy Cell")
- else
- if rsleft==15 and rsright~=15 then
- redstone.setOutput("top",false)
- redstone.setOutput("bottom",true)
- redstone.setOutput("back",true)
- print("-------")
- print("The Left Energy Cell is full")
- print("Using the Left Energy Cell")
- else
- print("-------")
- print("Error")
- print("Error Report")
- print(redstone.getAnalogInput("left"))
- print(redstone.getAnalogInput("right"))
- redstone.setOutput("top",true)
- redstone.setOutput("bottom",true)
- redstone.setOutput("back",true)
- break
- end
- end
- end
- end
- end
- end
- end
- end
- end
- m.clear()
- m.setCursorPos(15,2)
- m.setTextColor(colors.orange)
- m.write("Energy Cells")
- m.setCursorPos(4,5)
- m.write("Left Cell: ")
- m.setCursorPos(21,5)
- m.write("Right Cell: ")
- m.setCursorPos(15,5)
- if rsleft==15 then
- m.setTextColor(colors.green)
- m.write("100%")
- else
- if rsleft==7 then
- m.setTextColor(colors.orange)
- m.write("50%")
- else
- if rsleft==0 then
- m.setTextColor(colors.red)
- m.write("0%")
- else
- if rsleft==14 then
- m.setTextColor(colors.green)
- m.write("100%")
- else
- if rsleft==13 then
- m.setTextColor(colors.green)
- m.write("85%")
- else
- if rsleft==12 then
- m.setTextColor(colors.green)
- m.write("80%")
- else
- if rsleft==11 then
- m.setTextColor(colors.green)
- m.write("70%")
- else
- if rsleft==10 then
- m.setTextColor(colors.orange)
- m.write("65%")
- else
- if rsleft==9 then
- m.setTextColor(colors.orange)
- m.write("60%")
- else
- if rsleft==8 then
- m.setTextColor(colors.orange)
- m.write("55%")
- else
- if rsleft==6 then
- m.setTextColor(colors.orange)
- m.write("40%")
- else
- if rsleft==5 then
- m.setTextColor(colors.red)
- m.write("30%")
- else
- if rsleft==4 then
- m.setTextColor(colors.red)
- m.write("25%")
- else
- if rsleft==3 then
- m.setTextColor(colors.red)
- m.write("20%")
- else
- if rsleft==2 then
- m.setTextColor(colors.red)
- m.write("15%")
- else
- if rsleft==1 then
- m.setTextColor(colors.red)
- m.write("5%")
- else
- m.setTextColor(colors.red)
- m.write("Error")
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- m.setCursorPos(33,5)
- if rsright==15 then
- m.setTextColor(colors.green)
- m.write("100%")
- else
- if rsright==7 then
- m.setTextColor(colors.orange)
- m.write("50%")
- else
- if rsright==0 then
- m.setTextColor(colors.red)
- m.write("0%")
- else
- if rsright==14 then
- m.setTextColor(colors.green)
- m.write("100%")
- else
- if rsright==13 then
- m.setTextColor(colors.green)
- m.write("85%")
- else
- if rsright==12 then
- m.setTextColor(colors.green)
- m.write("80%")
- else
- if rsright==11 then
- m.setTextColor(colors.green)
- m.write("70%")
- else
- if rsright==10 then
- m.setTextColor(colors.orange)
- m.write("65%")
- else
- if rsright==9 then
- m.setTextColor(colors.orange)
- m.write("60%")
- else
- if rsright==8 then
- m.setTextColor(colors.orange)
- m.write("55%")
- else
- if rsright==6 then
- m.setTextColor(colors.orange)
- m.write("40%")
- else
- if rsright==5 then
- m.setTextColor(colors.red)
- m.write("30%")
- else
- if rsright==4 then
- m.setTextColor(colors.red)
- m.write("25%")
- else
- if rsright==3 then
- m.setTextColor(colors.red)
- m.write("20%")
- else
- if rsright==2 then
- m.setTextColor(colors.red)
- m.write("15%")
- else
- if rsright==1 then
- m.setTextColor(colors.red)
- m.write("5%")
- else
- m.setTextColor(colors.red)
- m.write("Error")
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- sleep(2)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement