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_1")
- react1 = peripheral.wrap("BigReactors-Reactor_0")
- react2 = peripheral.wrap("BigReactors-Reactor_1")
- react3 = peripheral.wrap("BigReactors-Reactor_2")
- AnzReact = 3
- print(react1, react2, react3)
- print(react1.getConnected, react2.getConnected, react3.getConnected)
- react2.setActive(false)
- print("R2:", react2.isActive)
- react3.setActive(false)
- print("R3:", react3.isActive)
- ron1 = true
- rrod1 = 50
- react1.setAllControlRodLevels(rrod1)
- react1.setActive(ron1)
- print("R1:", react1.isActive)
- if AnzReact > 1 then
- ron2 = true
- rrod2 = 92
- react2.setAllControlRodLevels(rrod2)
- react2.setActive(ron2)
- print("R2:", react2.isActive)
- end
- if AnzReact > 2 then
- ron3 = false
- rrod3 = 92
- react3.setAllControlRodLevels(rrod3)
- react3.setActive(ron3)
- print("R3:", react3.isActive)
- end
- function MonAufbau(moni)
- moni.setTextScale(0.5)
- moni.setBackgroundColor(colors.black)
- moni.clear()
- if AnzReact<3 then
- moni.setCursorPos(4,1)
- else
- moni.setCursorPos(13,1)
- end
- 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")
- if AnzReact > 1 then
- moni.setCursorPos(19,3)
- moni.write("Reactor2")
- end
- if AnzReact > 2 then
- moni.setCursorPos(37,3)
- moni.write("Reactor3")
- end
- moni.setCursorPos(10,3)
- if ron1 == true then
- moni.setTextColor(colors.green)
- moni.write("online")
- else
- moni.setTextColor(colors.red)
- moni.write("offline")
- end
- if AnzReact > 1 then
- moni.setCursorPos(28,3)
- if ron2 == true then
- moni.setTextColor(colors.green)
- moni.write("online")
- else
- moni.setTextColor(colors.red)
- moni.write("offline")
- end
- end
- if AnzReact > 2 then
- moni.setCursorPos(46,3)
- if ron3 == true then
- moni.setTextColor(colors.green)
- moni.write("online")
- else
- moni.setTextColor(colors.red)
- moni.write("offline")
- end
- end
- moni.setBackgroundColor(colors.lime)
- moni.setTextColor(colors.white)
- moni.setCursorPos(4,4)
- moni.write(" ON ")
- if AnzReact > 1 then
- moni.setCursorPos(22,4)
- moni.write(" ON ")
- end
- if AnzReact > 2 then
- moni.setCursorPos(40,4)
- moni.write(" ON ")
- end
- moni.setBackgroundColor(colors.red)
- moni.setCursorPos(10,4)
- moni.write(" OFF ")
- if AnzReact > 1 then
- moni.setCursorPos(28,4)
- moni.write(" OFF ")
- end
- if AnzReact > 2 then
- moni.setCursorPos(46,4)
- moni.write(" OFF ")
- end
- moni.setBackgroundColor(colors.black)
- moni.setTextColor(colors.blue)
- moni.setCursorPos(1,6)
- moni.write("ControlRods: %")
- moni.setCursorPos(14,6)
- moni.write(string.format("%3d",rrod1))
- if AnzReact > 1 then
- moni.setCursorPos(19,6)
- moni.write("ControlRods: %")
- moni.setCursorPos(32,6)
- moni.write(string.format("%3d",rrod2))
- end
- if AnzReact > 2 then
- moni.setCursorPos(37,6)
- moni.write("ControlRods: %")
- moni.setCursorPos(50,6)
- moni.write(string.format("%3d",rrod3))
- end
- 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 ")
- if AnzReact > 1 then
- moni.setCursorPos(20,7)
- moni.write(" 0 ")
- moni.setCursorPos(25,7)
- moni.write(" 50 ")
- moni.setCursorPos(31 ,7)
- moni.write(" 100 ")
- end
- if AnzReact > 2 then
- moni.setCursorPos(38,7)
- moni.write(" 0 ")
- moni.setCursorPos(43,7)
- moni.write(" 50 ")
- moni.setCursorPos(49 ,7)
- moni.write(" 100 ")
- end
- 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")
- if AnzReact > 1 then
- 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
- if AnzReact > 2 then
- moni.setCursorPos(38,8)
- moni.write("-10")
- moni.setCursorPos(42,8)
- moni.write(" -1")
- moni.setCursorPos(47,8)
- moni.write(" +1")
- moni.setCursorPos(51,8)
- moni.write("+10")
- end
- end
- function ChangeRT(chNr, chVal)
- if chNr == 1 then
- rrod1 = chVal
- react1.setAllControlRodLevels(rrod1)
- elseif chNr == 2 then
- rrod2 = chVal
- react2.setAllControlRodLevels(rrod2)
- else
- rrod3 = chVal
- react3.setAllControlRodLevels(rrod3)
- end
- end
- function ChangeR(chNr, chVal)
- if chNr == 1 then
- rrod1 = rrod1 + chVal
- react1.setAllControlRodLevels(rrod1)
- elseif chNr == 2 then
- rrod2 = rrod2 + chVal
- react2.setAllControlRodLevels(rrod2)
- else
- rrod3 = rrod3 + chVal
- react3.setAllControlRodLevels(rrod3)
- 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_1") 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)
- elseif (x > 39) and (x < 45) then
- ron3=true
- react3.setActive(ron3)
- elseif (x > 45) and (x < 51) then
- ron3=false
- react3.setActive(ron3)
- 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)
- elseif (x > 37) and (x < 41) then
- ChangeRT(3,0)
- elseif (x > 42) and (x < 47) then
- ChangeRT(3,50)
- elseif (x > 48) and (x < 54) then
- ChangeRT(3,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)
- elseif (x > 37) and (x < 41) then
- ChangeR(3,-10)
- elseif (x > 41) and (x < 45) then
- ChangeR(3,-1)
- elseif (x > 44) and (x < 50) then
- ChangeR(3,1)
- elseif (x > 50) and (x < 54) then
- ChangeR(3,10)
- end
- end
- MonAufbau(monitor1)
- MonAufbau(monitor2)
- --MonAufbau(monitor3)
- end
- else
- print(event, button, x, y)
- end
- end
Add Comment
Please, Sign In to add comment