Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- monitor1 = peripheral.wrap("top")
- monitor2 = peripheral.wrap("monitor_0")
- --monitor3 = peripheral.wrap("monitor_34")
- react1 = peripheral.wrap("BigReactors_Reactor_0")
- react2 = peripheral.wrap("BigReactors_Reactor_1")
- print(react1, react2)
- print(react1.getConnected, react2.getConnected)
- react1.setActive(true)
- print("R1:", react1.isActive)
- react2.setActive(false)
- print("R2:", react2.isActive)
- ron1 = true
- ron2 = false
- rrod1 = 97
- rrod2 = 90
- react1.setAllControlRodLevels(rrod1)
- react2.setAllControlRodLevels(rrod2)
- function MonAufbau(moni)
- moni.setTextScale(0.5)
- moni.setBackgroundColor(colors.black)
- moni.clear()
- moni.setCursorPos(4,1)
- moni.setBackgroundColor(colors.blue)
- moni.setTextColor(colors.orange)
- moni.write(" *** WuffelPower Control *** ")
- moni.setBackgroundColor(colors.black)
- moni.setTextColor(colors.blue)
- moni.setCursorPos(1,3)
- moni.write("Reactor1")
- moni.setCursorPos(19,3)
- moni.write("Reactor2")
- moni.setCursorPos(10,3)
- if ron1 == true then
- moni.setTextColor(colors.green)
- moni.write("online")
- else
- moni.setTextColor(colors.red)
- moni.write("offline")
- end
- moni.setCursorPos(28,3)
- if ron2 == true then
- moni.setTextColor(colors.green)
- moni.write("online")
- else
- moni.setTextColor(colors.red)
- moni.write("offline")
- end
- moni.setBackgroundColor(colors.lime)
- moni.setTextColor(colors.white)
- moni.setCursorPos(4,4)
- moni.write(" ON ")
- moni.setCursorPos(22,4)
- moni.write(" ON ")
- moni.setBackgroundColor(colors.red)
- moni.setCursorPos(10,4)
- moni.write(" OFF ")
- moni.setCursorPos(28,4)
- moni.write(" OFF ")
- moni.setBackgroundColor(colors.black)
- moni.setTextColor(colors.blue)
- moni.setCursorPos(1,6)
- moni.write("ControlRods: %")
- moni.setCursorPos(19,6)
- moni.write("ControlRods: %")
- moni.setCursorPos(14,6)
- moni.write(string.format("%3d",rrod1))
- moni.setCursorPos(32,6)
- moni.write(string.format("%3d",rrod2))
- moni.setBackgroundColor(colors.lightGray)
- moni.setTextColor(colors.orange)
- moni.setCursorPos(2,7)
- moni.write(" 0 ")
- moni.setCursorPos(7,7)
- moni.write(" 50 ")
- moni.setCursorPos(13,7)
- moni.write(" 100 ")
- moni.setCursorPos(20,7)
- moni.write(" 0 ")
- moni.setCursorPos(25,7)
- moni.write(" 50 ")
- moni.setCursorPos(31 ,7)
- moni.write(" 100 ")
- moni.setBackgroundColor(colors.blue)
- moni.setCursorPos(2,8)
- moni.write("-10")
- moni.setCursorPos(6,8)
- moni.write(" -1")
- moni.setCursorPos(11,8)
- moni.write(" +1")
- moni.setCursorPos(15,8)
- moni.write("+10")
- moni.setCursorPos(20,8)
- moni.write("-10")
- moni.setCursorPos(24,8)
- moni.write(" -1")
- moni.setCursorPos(29,8)
- moni.write(" +1")
- moni.setCursorPos(33,8)
- moni.write("+10")
- end
- function ChangeRT(chNr, chVal)
- if chNr == 1 then
- rrod1 = chVal
- react1.setAllControlRodLevels(rrod1)
- else
- rrod2 = chVal
- react2.setAllControlRodLevels(rrod2)
- end
- end
- function ChangeR(chNr, chVal)
- if chNr == 1 then
- rrod1 = rrod1 + chVal
- react1.setAllControlRodLevels(rrod1)
- else
- rrod2 = rrod2 + chVal
- react2.setAllControlRodLevels(rrod2)
- end
- end
- MonAufbau(monitor1)
- MonAufbau(monitor2)
- -- MonAufbau(monitor3)
- while true do
- event, button, x, y = os.pullEvent()
- if event == "terminate" then
- break
- elseif event == "monitor_touch" then
- if (button == "top") or (button == "monitor_0") or (button == "monitor_34") then
- if y == 4 then
- if (x > 3) and (x < 9) then
- ron1=true
- react1.setActive(ron1)
- elseif (x > 9) and (x < 15) then
- ron1=false
- react1.setActive(ron1)
- elseif (x > 21) and (x < 27) then
- ron2=true
- react2.setActive(ron2)
- elseif (x > 27) and (x < 33) then
- ron2=false
- react2.setActive(ron2)
- end
- elseif y == 7 then
- if (x > 1) and (x < 5) then
- ChangeRT(1,0)
- elseif (x > 6) and (x < 11) then
- ChangeRT(1,50)
- elseif (x > 12) and (x < 18) then
- ChangeRT(1,100)
- elseif (x > 19) and (x < 23) then
- ChangeRT(2,0)
- elseif (x > 24) and (x < 29) then
- ChangeRT(2,50)
- elseif (x > 30) and (x < 36) then
- ChangeRT(2,100)
- end
- elseif y == 8 then
- if (x > 1) and (x < 5) then
- ChangeR(1,-10)
- elseif (x > 5) and (x < 9) then
- ChangeR(1,-1)
- elseif (x > 10) and (x < 14) then
- ChangeR(1,1)
- elseif (x > 14) and (x < 18) then
- ChangeR(1,10)
- elseif (x > 19) and (x < 23) then
- ChangeR(2,-10)
- elseif (x > 23) and (x < 27) then
- ChangeR(2,-1)
- elseif (x > 28) and (x < 32) then
- ChangeR(2,1)
- elseif (x > 32) and (x < 36) then
- ChangeR(2,10)
- end
- end
- MonAufbau(monitor1)
- MonAufbau(monitor2)
- -- MonAufbau(monitor3)
- end
- else
- print(event, button, x, y)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement