Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.pullEvent = os.pullEventRaw
- function ctcr(leftf,rightf,frontf,backf,topf,bottomf)
- term.clear()
- paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
- paintutils.drawBox(1,1,51,19,colors.blue)
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(3,3)
- print("Control This Computer's Output")
- x1,y1 = 3,5
- x2,y2 = 3,7
- x3,y3 = 3,9
- x4,y4 = 3,11
- x5,y5 = 3,13
- x6,y6 = 3,15
- x7,y7 = 3,17
- choice1 = " Left "
- choice2 = " Right "
- choice3 = " Front "
- choice4 = " Back "
- choice5 = " Top "
- choice6 = " Bottom "
- choice7 = " Exit "
- term.setBackgroundColor(colors.red)
- term.setCursorPos(x1,y1)
- write(choice1)
- term.setCursorPos(x2,y2)
- write(choice2)
- term.setCursorPos(x3,y3)
- write(choice3)
- term.setCursorPos(x4,y4)
- write(choice4)
- term.setCursorPos(x5,y5)
- write(choice5)
- term.setCursorPos(x6,y6)
- write(choice6)
- term.setCursorPos(x7,y7)
- write(choice7)
- while true do
- local event, button, cx, cy = os.pullEvent()
- if event == "mouse_click" then
- if cx > x1 and cx < x1 + choice1:len() and cy == y1 and button == 1 then
- term.clear()
- paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
- paintutils.drawBox(1,1,51,19,colors.blue)
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(3,3)
- print("Turn Left Output On Or Off?")
- local x1,y1 = 3,6
- local x2,y2 = 3,8
- local x3,y3 = 3,10
- local choice1 = " On "
- local choice2 = " Off "
- local choice3 = " Exit "
- term.setBackgroundColor(colors.red)
- term.setCursorPos(x1,y1)
- write(choice1)
- term.setCursorPos(x2,y2)
- write(choice2)
- term.setCursorPos(x3,y3)
- write(choice3)
- while true do
- local event, button, cx, cy = os.pullEvent()
- if event == "mouse_click" then
- if cx > x1 and cx < x1 + choice1:len() and cy == y1 and button == 1 then
- redstone.setOutput("left",true)
- f = fs.open(leftf,"w")
- f.write("1")
- f.close()
- ctcr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x2 and cx < x2 + choice2:len() and cy == y2 and button == 1 then
- redstone.setOutput("left",false)
- f = fs.open(leftf,"w")
- f.write("0")
- f.close()
- ctcr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x3 and cx < x3 + choice3:len() and cy == y3 and button == 1 then
- ctcr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- end
- end
- end
- end
- end
- ctcr(leftf,rightf,frontf,backf,topf,bottomf)
- else if cx > x2 and cx < x2 + choice2:len() and cy == y2 and button == 1 then
- term.clear()
- paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
- paintutils.drawBox(1,1,51,19,colors.blue)
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(3,3)
- print("Turn Right Output On Or Off?")
- local x1,y1 = 3,6
- local x2,y2 = 3,8
- local x3,y3 = 3,10
- local choice1 = " On "
- local choice2 = " Off "
- local choice3 = " Exit "
- term.setBackgroundColor(colors.red)
- term.setCursorPos(x1,y1)
- write(choice1)
- term.setCursorPos(x2,y2)
- write(choice2)
- term.setCursorPos(x3,y3)
- write(choice3)
- while true do
- local event, button, cx, cy = os.pullEvent()
- if event == "mouse_click" then
- if cx > x1 and cx < x1 + choice1:len() and cy == y1 and button == 1 then
- redstone.setOutput("right",true)
- f = fs.open(rightf,"w")
- f.write("1")
- f.close()
- ctcr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x2 and cx < x2 + choice2:len() and cy == y2 and button == 1 then
- redstone.setOutput("right",false)
- f = fs.open(rightf,"w")
- f.write("0")
- f.close()
- ctcr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x3 and cx < x3 + choice3:len() and cy == y3 and button == 1 then
- ctcr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- end
- end
- end
- end
- end
- ctcr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x3 and cx < x3 + choice3:len() and cy == y3 and button == 1 then
- term.clear()
- paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
- paintutils.drawBox(1,1,51,19,colors.blue)
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(3,3)
- print("Turn Front Output On Or Off?")
- local x1,y1 = 3,6
- local x2,y2 = 3,8
- local x3,y3 = 3,10
- local choice1 = " On "
- local choice2 = " Off "
- local choice3 = " Exit "
- term.setBackgroundColor(colors.red)
- term.setCursorPos(x1,y1)
- write(choice1)
- term.setCursorPos(x2,y2)
- write(choice2)
- term.setCursorPos(x3,y3)
- write(choice3)
- while true do
- local event, button, cx, cy = os.pullEvent()
- if event == "mouse_click" then
- if cx > x1 and cx < x1 + choice1:len() and cy == y1 and button == 1 then
- redstone.setOutput("front",true)
- f = fs.open(frontf,"w")
- f.write("1")
- f.close()
- ctcr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x2 and cx < x2 + choice2:len() and cy == y2 and button == 1 then
- redstone.setOutput("front",false)
- f = fs.open(frontf,"w")
- f.write("0")
- f.close()
- ctcr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x3 and cx < x3 + choice3:len() and cy == y3 and button == 1 then
- ctcr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- end
- end
- end
- end
- end
- ctcr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x4 and cx < x4 + choice4:len() and cy == y4 and button == 1 then
- term.clear()
- paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
- paintutils.drawBox(1,1,51,19,colors.blue)
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(3,3)
- print("Turn Back Output On Or Off?")
- local x1,y1 = 3,6
- local x2,y2 = 3,8
- local x3,y3 = 3,10
- local choice1 = " On "
- local choice2 = " Off "
- local choice3 = " Exit "
- term.setBackgroundColor(colors.red)
- term.setCursorPos(x1,y1)
- write(choice1)
- term.setCursorPos(x2,y2)
- write(choice2)
- term.setCursorPos(x3,y3)
- write(choice3)
- while true do
- local event, button, cx, cy = os.pullEvent()
- if event == "mouse_click" then
- if cx > x1 and cx < x1 + choice1:len() and cy == y1 and button == 1 then
- redstone.setOutput("back",true)
- f = fs.open(backf,"w")
- f.write("1")
- f.close()
- ctcr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x2 and cx < x2 + choice2:len() and cy == y2 and button == 1 then
- redstone.setOutput("back",false)
- f = fs.open(backf,"w")
- f.write("0")
- f.close()
- ctcr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x3 and cx < x3 + choice3:len() and cy == y3 and button == 1 then
- ctcr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- end
- end
- end
- end
- end
- ctcr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x5 and cx < x5 + choice5:len() and cy == y5 and button == 1 then
- term.clear()
- paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
- paintutils.drawBox(1,1,51,19,colors.blue)
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(3,3)
- print("Turn Top Output On Or Off?")
- local x1,y1 = 3,6
- local x2,y2 = 3,8
- local x3,y3 = 3,10
- local choice1 = " On "
- local choice2 = " Off "
- local choice3 = " Exit "
- term.setBackgroundColor(colors.red)
- term.setCursorPos(x1,y1)
- write(choice1)
- term.setCursorPos(x2,y2)
- write(choice2)
- term.setCursorPos(x3,y3)
- write(choice3)
- while true do
- local event, button, cx, cy = os.pullEvent()
- if event == "mouse_click" then
- if cx > x1 and cx < x1 + choice1:len() and cy == y1 and button == 1 then
- redstone.setOutput("top",true)
- f = fs.open(topf,"w")
- f.write("1")
- f.close()
- ctcr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x2 and cx < x2 + choice2:len() and cy == y2 and button == 1 then
- redstone.setOutput("top",false)
- f = fs.open(topf,"w")
- f.write("0")
- f.close()
- ctcr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x3 and cx < x3 + choice3:len() and cy == y3 and button == 1 then
- ctcr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- end
- end
- end
- end
- end
- ctcr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x6 and cx < x6 + choice6:len() and cy == y6 and button == 1 then
- term.clear()
- paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
- paintutils.drawBox(1,1,51,19,colors.blue)
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(3,3)
- print("Turn Bottom Output On Or Off?")
- local x1,y1 = 3,6
- local x2,y2 = 3,8
- local x3,y3 = 3,10
- local choice1 = " On "
- local choice2 = " Off "
- local choice3 = " Exit "
- term.setBackgroundColor(colors.red)
- term.setCursorPos(x1,y1)
- write(choice1)
- term.setCursorPos(x2,y2)
- write(choice2)
- term.setCursorPos(x3,y3)
- write(choice3)
- while true do
- local event, button, cx, cy = os.pullEvent()
- if event == "mouse_click" then
- if cx > x1 and cx < x1 + choice1:len() and cy == y1 and button == 1 then
- redstone.setOutput("bottom",true)
- f = fs.open(bottomf,"w")
- f.write("1")
- f.close()
- ctcr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x2 and cx < x2 + choice2:len() and cy == y2 and button == 1 then
- redstone.setOutput("bottom",false)
- f = fs.open(bottomf,"w")
- f.write("0")
- f.close()
- ctcr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x3 and cx < x3 + choice3:len() and cy == y3 and button == 1 then
- ctcr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- end
- end
- end
- end
- end
- ctcr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x7 and cx < x7 + choice7:len() and cy == y7 and button == 1 then
- ram(leftf,rightf,frontf,backf,topf,bottomf)
- break
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- function cocr(leftf,rightf,frontf,backf,topf,bottomf)
- term.clear()
- paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
- paintutils.drawBox(1,1,51,19,colors.blue)
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(3,3)
- print("Enter a computer ID to control")
- term.setCursorPos(3,6)
- print("ID:")
- term.setCursorPos(6,6)
- sed = read()
- rednet.open("top")
- rednet.send(tonumber(sed),"cr")
- local senderid, message, protocol = rednet.receive(10)
- rednet.close("top")
- if message == nil then
- term.clear()
- paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
- paintutils.drawBox(1,1,51,19,colors.blue)
- term.setCursorPos(3,3)
- print("No response")
- term.setCursorPos(3,5)
- print("The target computer either isnt running red alert server or doesnt exist")
- sleep(5)
- ram(leftf,rightf,frontf,backf,topf,bottomf)
- end
- if message == "n" then
- term.clear()
- paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
- paintutils.drawBox(1,1,51,19,colors.blue)
- term.setCursorPos(3,3)
- print("Request denied")
- term.setCursorPos(3,5)
- print("The target computer denied your request, it may be already taking a request")
- sleep(5)
- ram(leftf,rightf,frontf,backf,topf,bottomf)
- end
- term.clear()
- paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
- paintutils.drawBox(1,1,51,19,colors.blue)
- term.setCursorPos(3,3)
- print("Control "..sed.."'s output")
- local x1,y1 = 3,5
- local x2,y2 = 3,7
- local x3,y3 = 3,9
- local x4,y4 = 3,11
- local x5,y5 = 3,13
- local x6,y6 = 3,15
- local x7,y7 = 3,17
- local choice1 = " Left "
- local choice2 = " Right "
- local choice3 = " Front "
- local choice4 = " Back "
- local choice5 = " Top "
- local choice6 = " Bottom "
- local choice7 = " Exit "
- term.setBackgroundColor(colors.red)
- term.setCursorPos(x1,y1)
- write(choice1)
- term.setCursorPos(x2,y2)
- write(choice2)
- term.setCursorPos(x3,y3)
- write(choice3)
- term.setCursorPos(x4,y4)
- write(choice4)
- term.setCursorPos(x5,y5)
- write(choice5)
- term.setCursorPos(x6,y6)
- write(choice6)
- term.setCursorPos(x7,y7)
- write(choice7)
- while true do
- local event, button, cx, cy = os.pullEvent()
- if event == "mouse_click" then
- if cx > x1 and cx < x1 + choice1:len() and cy == y1 and button == 1 then
- term.clear()
- paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
- paintutils.drawBox(1,1,51,19,colors.blue)
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(3,3)
- print("Turn Left Output On Or Off?")
- local x1,y1 = 3,6
- local x2,y2 = 3,8
- local x3,y3 = 3,10
- local choice1 = " On "
- local choice2 = " Off "
- local choice3 = " Exit "
- term.setBackgroundColor(colors.red)
- term.setCursorPos(x1,y1)
- write(choice1)
- term.setCursorPos(x2,y2)
- write(choice2)
- term.setCursorPos(x3,y3)
- write(choice3)
- while true do
- local event, button, cx, cy = os.pullEvent()
- if event == "mouse_click" then
- if cx > x1 and cx < x1 + choice1:len() and cy == y1 and button == 1 then
- rednet.open("top")
- rednet.send(tonumber(sed),"lon")
- rednet.close("top")
- cocr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x2 and cx < x2 + choice2:len() and cy == y2 and button == 1 then
- rednet.open("top")
- rednet.send(tonumber(sed),"loff")
- rednet.close("top")
- cocr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x3 and cx < x3 + choice3:len() and cy == y3 and button == 1 then
- cocr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- end
- end
- end
- end
- end
- break
- else if cx > x2 and cx < x2 + choice2:len() and cy == y2 and button == 1 then
- term.clear()
- paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
- paintutils.drawBox(1,1,51,19,colors.blue)
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(3,3)
- print("Turn Right Output On Or Off?")
- local x1,y1 = 3,6
- local x2,y2 = 3,8
- local x3,y3 = 3,10
- local choice1 = " On "
- local choice2 = " Off "
- local choice3 = " Exit "
- term.setBackgroundColor(colors.red)
- term.setCursorPos(x1,y1)
- write(choice1)
- term.setCursorPos(x2,y2)
- write(choice2)
- term.setCursorPos(x3,y3)
- write(choice3)
- while true do
- local event, button, cx, cy = os.pullEvent()
- if event == "mouse_click" then
- if cx > x1 and cx < x1 + choice1:len() and cy == y1 and button == 1 then
- rednet.open("top")
- rednet.send(tonumber(sed),"ron")
- rednet.close("top")
- cocr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x2 and cx < x2 + choice2:len() and cy == y2 and button == 1 then
- rednet.open("top")
- rednet.send(tonumber(sed),"roff")
- rednet.close("top")
- cocr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x3 and cx < x3 + choice3:len() and cy == y3 and button == 1 then
- cocr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- end
- end
- end
- end
- end
- break
- else if cx > x3 and cx < x3 + choice3:len() and cy == y3 and button == 1 then
- term.clear()
- paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
- paintutils.drawBox(1,1,51,19,colors.blue)
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(3,3)
- print("Turn Front Output On Or Off?")
- local x1,y1 = 3,6
- local x2,y2 = 3,8
- local x3,y3 = 3,10
- local choice1 = " On "
- local choice2 = " Off "
- local choice3 = " Exit "
- term.setBackgroundColor(colors.red)
- term.setCursorPos(x1,y1)
- write(choice1)
- term.setCursorPos(x2,y2)
- write(choice2)
- term.setCursorPos(x3,y3)
- write(choice3)
- while true do
- local event, button, cx, cy = os.pullEvent()
- if event == "mouse_click" then
- if cx > x1 and cx < x1 + choice1:len() and cy == y1 and button == 1 then
- rednet.open("top")
- rednet.send(tonumber(sed),"fon")
- rednet.close("top")
- cocr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x2 and cx < x2 + choice2:len() and cy == y2 and button == 1 then
- rednet.open("top")
- rednet.send(tonumber(sed),"foff")
- rednet.close("top")
- cocr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x3 and cx < x3 + choice3:len() and cy == y3 and button == 1 then
- cocr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- end
- end
- end
- end
- end
- break
- else if cx > x4 and cx < x4 + choice4:len() and cy == y4 and button == 1 then
- term.clear()
- paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
- paintutils.drawBox(1,1,51,19,colors.blue)
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(3,3)
- print("Turn Back Output On Or Off?")
- local x1,y1 = 3,6
- local x2,y2 = 3,8
- local x3,y3 = 3,10
- local choice1 = " On "
- local choice2 = " Off "
- local choice3 = " Exit "
- term.setBackgroundColor(colors.red)
- term.setCursorPos(x1,y1)
- write(choice1)
- term.setCursorPos(x2,y2)
- write(choice2)
- term.setCursorPos(x3,y3)
- write(choice3)
- while true do
- local event, button, cx, cy = os.pullEvent()
- if event == "mouse_click" then
- if cx > x1 and cx < x1 + choice1:len() and cy == y1 and button == 1 then
- rednet.open("top")
- rednet.send(tonumber(sed),"baon")
- rednet.close("top")
- cocr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x2 and cx < x2 + choice2:len() and cy == y2 and button == 1 then
- rednet.open("top")
- rednet.send(tonumber(sed),"baoff")
- rednet.close("top")
- cocr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x3 and cx < x3 + choice3:len() and cy == y3 and button == 1 then
- cocr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- end
- end
- end
- end
- end
- break
- else if cx > x5 and cx < x5 + choice5:len() and cy == y5 and button == 1 then
- term.clear()
- paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
- paintutils.drawBox(1,1,51,19,colors.blue)
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(3,3)
- print("Turn Top Output On Or Off?")
- local x1,y1 = 3,6
- local x2,y2 = 3,8
- local x3,y3 = 3,10
- local choice1 = " On "
- local choice2 = " Off "
- local choice3 = " Exit "
- term.setBackgroundColor(colors.red)
- term.setCursorPos(x1,y1)
- write(choice1)
- term.setCursorPos(x2,y2)
- write(choice2)
- term.setCursorPos(x3,y3)
- write(choice3)
- while true do
- local event, button, cx, cy = os.pullEvent()
- if event == "mouse_click" then
- if cx > x1 and cx < x1 + choice1:len() and cy == y1 and button == 1 then
- rednet.open("top")
- rednet.send(tonumber(sed),"ton")
- rednet.close("top")
- cocr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x2 and cx < x2 + choice2:len() and cy == y2 and button == 1 then
- rednet.open("top")
- rednet.send(tonumber(sed),"toff")
- rednet.close("top")
- cocr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x3 and cx < x3 + choice3:len() and cy == y3 and button == 1 then
- cocr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- end
- end
- end
- end
- end
- break
- else if cx > x6 and cx < x6 + choice6:len() and cy == y6 and button == 1 then
- term.clear()
- paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
- paintutils.drawBox(1,1,51,19,colors.blue)
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(3,3)
- print("Turn Bottom Output On Or Off?")
- local x1,y1 = 3,6
- local x2,y2 = 3,8
- local x3,y3 = 3,10
- local choice1 = " On "
- local choice2 = " Off "
- local choice3 = " Exit "
- term.setBackgroundColor(colors.red)
- term.setCursorPos(x1,y1)
- write(choice1)
- term.setCursorPos(x2,y2)
- write(choice2)
- term.setCursorPos(x3,y3)
- write(choice3)
- while true do
- local event, button, cx, cy = os.pullEvent()
- if event == "mouse_click" then
- if cx > x1 and cx < x1 + choice1:len() and cy == y1 and button == 1 then
- rednet.open("top")
- rednet.send(tonumber(sed),"boon")
- rednet.close("top")
- cocr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x2 and cx < x2 + choice2:len() and cy == y2 and button == 1 then
- rednet.open("top")
- rednet.send(tonumber(sed),"boff")
- rednet.close("top")
- cocr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x3 and cx < x3 + choice3:len() and cy == y3 and button == 1 then
- cocr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- end
- end
- end
- end
- end
- break
- else if cx > x7 and cx < x7 + choice7:len() and cy == y7 and button == 1 then
- rednet.send(tonumber(sedt),"ce")
- ram(leftf,rightf,frontf,backf,topf,bottomf)
- break
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- function rs(leftf,rightf,frontf,backf,topf,bottomf)
- term.clear()
- paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
- paintutils.drawBox(1,1,51,19,colors.blue)
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(3,3)
- print("Red Alert Settings")
- local x1,y1 = 3,5
- local x2,y2 = 3,7
- local choice1 = " Change Directory "
- local choice2 = " Exit "
- term.setBackgroundColor(colors.red)
- term.setCursorPos(x1,y1)
- write(choice1)
- term.setCursorPos(x2,y2)
- write(choice2)
- while true do
- local event, button, cx, cy = os.pullEvent()
- if event == "mouse_click" then
- if cx > x1 and cx < x1 + choice1:len() and cy == y1 and button == 1 then
- term.clear()
- paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
- paintutils.drawBox(1,1,51,19,colors.blue)
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(3,3)
- print("Enter a directory")
- term.setCursorPos(3,5)
- print("Directory:")
- term.setCursorPos(13,5)
- nd = read()
- if not fs.exists(nd) then
- term.setCursorPos(3,7)
- print("Directory doesnt exist")
- sleep(3)
- rs(leftf,rightf,frontf,backf,topf,bottomf)
- break
- end
- f = fs.open("/RAD","w")
- f.write(nd)
- f.close()
- ram(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x2 and cx < x2 + choice2:len() and cy == y2 and button == 1 then
- ram(leftf,rightf,frontf,backf,topf,bottomf)
- break
- end
- end
- end
- end
- end
- function stcr(leftf,rightf,frontf,backf,topf,bottomf)
- term.clear()
- paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
- paintutils.drawBox(1,1,51,19,colors.blue)
- term.setBackgroundColor(colors.lightBlue)
- f1 = fs.open(leftf,"r")
- f2 = fs.open(rightf,"r")
- f3 = fs.open(frontf,"r")
- f4 = fs.open(backf,"r")
- f5 = fs.open(topf,"r")
- f6 = fs.open(bottomf,"r")
- leftc = f1.readAll()
- rightc = f2.readAll()
- frontc = f3.readAll()
- backc = f4.readAll()
- topc = f5.readAll()
- bottomc = f6.readAll()
- f1.close()
- f2.close()
- f3.close()
- f4.close()
- f5.close()
- f6.close()
- if leftc == "0" then
- leftc = "no"
- else if leftc == "1" then
- leftc = "yes"
- end
- end
- if rightc == "0" then
- rightc = "no"
- else if rightc == "1" then
- rightc = "yes"
- end
- end
- if frontc == "0" then
- frontc = "no"
- else if frontc == "1" then
- frontc = "yes"
- end
- end
- if backc == "0" then
- backc = "no"
- else if backc == "1" then
- backc = "yes"
- end
- end
- if topc == "0" then
- topc = "no"
- else if topc == "1" then
- topc = "yes"
- end
- end
- if bottomc == "0" then
- bottomc = "no"
- else if bottomc == "1" then
- bottomc = "yes"
- end
- end
- term.setCursorPos(3,3)
- print("Left : "..leftc)
- term.setCursorPos(3,5)
- print("Right : "..rightc)
- term.setCursorPos(3,7)
- print("Front : "..frontc)
- term.setCursorPos(3,9)
- print("Back : "..backc)
- term.setCursorPos(3,11)
- print("Top : "..topc)
- term.setCursorPos(3,13)
- print("Bottom : "..bottomc)
- sleep(5)
- ram(leftf,rightf,frontf,backf,topf,bottomf)
- end
- function socr(leftf,rightf,frontf,backf,topf,bottomf)
- term.clear()
- paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
- paintutils.drawBox(1,1,51,19,colors.blue)
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(3,3)
- print("Enter an ID to check")
- term.setCursorPos(3,5)
- print("ID:")
- term.setCursorPos(6,5)
- sed = tonumber(read())
- rednet.open("top")
- rednet.send(sed,"rc")
- local senderId, msg1, protocol = rednet.receive(10)
- local senderId, msg2, protocol = rednet.receive(10)
- local senderId, msg3, protocol = rednet.receive(10)
- local senderId, msg4, protocol = rednet.receive(10)
- local senderId, msg5, protocol = rednet.receive(10)
- local senderId, msg6, protocol = rednet.receive(10)
- if msg1 == nil then
- term.setCursorPos(3,8)
- print("No Response")
- term.setCursorPos(3,10)
- print("Target computer may not be running red alert server or may not exist")
- end
- term.clear()
- paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
- paintutils.drawBox(1,1,51,19,colors.blue)
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(3,3)
- print("Left : "..msg1)
- print("Right : "..msg2)
- print("Front : "..msg3)
- print("Back : "..msg4)
- print("Top : "..msg5)
- print("Bottom : "..msg6)
- sleep(5)
- ram(leftf,rightf,frontf,backf,topf,bottomf)
- end
- function ram(leftf,rightf,frontf,backf,topf,bottomf)
- term.clear()
- paintutils.drawFilledBox(1,1,51,19,colors.lightBlue)
- paintutils.drawBox(1,1,51,19,colors.blue)
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.lightBlue)
- term.setCursorPos(3,3)
- print("Red Alert Menu")
- local x1,y1 = 3,6
- local x2,y2 = 3,8
- local x3,y3 = 3,10
- local x4,y4 = 3,12
- local x5,y5 = 3,14
- local x6,y6 = 3,16
- local choice1 = " Control This Computer's Redstone "
- local choice2 = " Control Other Computer's Redstone "
- local choice3 = " Exit "
- local choice4 = " Settings "
- local choice5 = " Show This Computer's Active Redstone "
- local choice6 = " Show Other Computer's Active Redstone "
- term.setBackgroundColor(colors.red)
- term.setCursorPos(x1,y1)
- write(choice1)
- term.setCursorPos(x2,y2)
- write(choice2)
- term.setCursorPos(x3,y3)
- write(choice3)
- term.setCursorPos(x4,y4)
- write(choice4)
- term.setCursorPos(x5,y5)
- write(choice5)
- term.setCursorPos(x6,y6)
- write(choice6)
- while true do
- local event, button, cx, cy = os.pullEvent()
- if event == "mouse_click" then
- if cx > x1 and cx < x1 + choice1:len() and cy == y1 and button == 1 then
- ctcr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x2 and cx < x2 + choice2:len() and cy == y2 and button == 1 then
- cocr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x3 and cx < x3 + choice3:len() and cy == y3 and button == 1 then
- fs.delete(leftf)
- fs.delete(rightf)
- fs.delete(frontf)
- fs.delete(backf)
- fs.delete(topf)
- fs.delete(bottomf)
- break
- else if cx > x4 and cx < x4 + choice4:len() and cy == y4 and button == 1 then
- rs(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x5 and cx < x5 + choice5:len() and cy == y5 and button == 1 then
- stcr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- else if cx > x6 and cx < x6 + choice6:len() and cy == y6 and button == 1 then
- socr(leftf,rightf,frontf,backf,topf,bottomf)
- break
- end
- end
- end
- end
- end
- end
- end
- end
- end
- function err(e)
- print("ERROR:"..e)
- print("Please report this error to the owner")
- sleep(5)
- end
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.red)
- print("Starting Red Alert")
- f = fs.open("/RAD","r")
- rad = f.readAll()
- f.close()
- print(rad)
- fs.makeDir(rad.."temp")
- radt = rad.."temp/"
- leftf = radt.."left"
- rightf = radt.."right"
- frontf = radt.."front"
- backf = radt.."back"
- topf = radt.."top"
- bottomf = radt.."bottom"
- print(leftf)
- print(rightf)
- print(frontf)
- print(backf)
- print(topf)
- print(bottomf)
- f1 = fs.open(leftf,"w")
- f2 = fs.open(rightf,"w")
- f3 = fs.open(frontf,"w")
- f4 = fs.open(backf,"w")
- f5 = fs.open(topf,"w")
- f6 = fs.open(bottomf,"w")
- f1.write("0")
- f2.write("0")
- f3.write("0")
- f4.write("0")
- f5.write("0")
- f6.write("0")
- f1.close()
- f2.close()
- f3.close()
- f4.close()
- f5.close()
- f6.close()
- f1 = fs.open(leftf,"r")
- f2 = fs.open(rightf,"r")
- f3 = fs.open(frontf,"r")
- f4 = fs.open(backf,"r")
- f5 = fs.open(topf,"r")
- f6 = fs.open(bottomf,"r")
- f1c = f1.readAll()
- f2c = f2.readAll()
- f3c = f3.readAll()
- f4c = f4.readAll()
- f5c = f5.readAll()
- f6c = f6.readAll()
- f1.close()
- f2.close()
- f3.close()
- f4.close()
- f5.close()
- f6.close()
- print(f1c)
- print(f2c)
- print(f3c)
- print(f4c)
- print(f5c)
- print(f6c)
- if not f1c == 0 then
- err("f1cn0")
- else if not f2c == 0 then
- err("f2cn0")
- else if not f3c == 0 then
- err("f3cn0")
- else if not f4c == 0 then
- err("f4cn0")
- else if not f5c == 0 then
- err("f5cn0")
- else if not f6c == 0 then
- err("f6cn0")
- end
- end
- end
- end
- end
- end
- print("Successfully started Red Alert 1.0")
- sleep(5)
- ram(leftf,rightf,frontf,backf,topf,bottomf)
Add Comment
Please, Sign In to add comment