Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Bundled Cable Remote for Network Control--
- -- MONITOR was CHANGED in monitor.cfg--
- --optimal monitor size 5*4--
- -- config--
- local channel = 21
- local backchan = 22
- modem = peripheral.wrap("back")
- local power = true
- local mon = ""
- --display name cable
- local white_na = "Light PC Room"
- local orange_na = "Light ME Room"
- local magenta_na = "Light Reactor"
- local lightblue_na = "Light Turbin"
- local yellow_na = "Light Tunnel"
- local lime_na = "lime"
- local pink_na = "pink"
- local grey_na = "gray"
- local lightgrey_na = "lightgray"
- local cyan_na = "cyan"
- local purple_na = "purple"
- local blue_na = "blue"
- local brown_na = "brown"
- local green_na = "green"
- local red_na = "red"
- local off_na = "All Off"
- local on_na = "All On"
- --load api
- shell.run("delete caAPI")
- shell.run("pastebin get EDLdR1nF caAPI")
- os.loadAPI("caAPI")
- --set monitor
- function set_monitor()
- local monitor_number = caAPI.get_hardware("monitor")
- local found = fs.exists("config/monitor.cfg")
- if found == true then
- file = fs.open("config/monitor.cfg","r")
- local fileData = {}
- local line = file.readLine()
- repeat
- table.insert(fileData,line)
- line = file.readLine()
- until line == nil
- file.close()
- monitor_number = fileData[1]
- end
- mon = peripheral.wrap(monitor_number)
- end
- --draw screen
- function draw_screen()
- mon.setBackgroundColor(colors.white)
- mon.setTextColor(colors.white)
- mon.clear()
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(1,1)
- mon.setBackgroundColor(colors.blue)
- mon.write("Cabel Remote Channel:"..channel.." ")
- mon.setCursorPos(50,1)
- mon.setBackgroundColor(colors.red)
- mon.setTextColor(colors.black)
- mon.write("X")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(1,2)
- mon.write(white_na)
- mon.setCursorPos(2,3)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(1,4)
- mon.write(orange_na)
- mon.setCursorPos(2,5)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(1,6)
- mon.write(magenta_na)
- mon.setCursorPos(2,7)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(1,8)
- mon.write(lightblue_na)
- mon.setCursorPos(2,9)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(1,10)
- mon.write(yellow_na)
- mon.setCursorPos(2,11)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(1,12)
- mon.write(lime_na)
- mon.setCursorPos(2,13)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(1,14)
- mon.write(pink_na)
- mon.setCursorPos(2,15)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(1,16)
- mon.write(grey_na)
- mon.setCursorPos(2,17)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(1,18)
- mon.write(lightgrey_na)
- mon.setCursorPos(2,19)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(1,20)
- mon.write(cyan_na)
- mon.setCursorPos(2,21)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(1,22)
- mon.write(purple_na)
- mon.setCursorPos(2,23)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(24,2)
- mon.write(blue_na)
- mon.setCursorPos(25,3)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(24,4)
- mon.write(brown_na)
- mon.setCursorPos(25,5)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(24,6)
- mon.write(green_na)
- mon.setCursorPos(25,7)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(24,8)
- mon.write(red_na)
- mon.setCursorPos(25,9)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(24,10)
- mon.write(off_na)
- mon.setCursorPos(25,11)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(24,12)
- mon.write(on_na)
- mon.setCursorPos(25,13)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(24,14)
- mon.write("Server shutdown")
- mon.setCursorPos(25,15)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- touch()
- end
- --touch event--
- function touch()
- event,side,x,y = os.pullEvent()
- if event == "monitor_touch" then
- if x == 50 and y == 1 then
- power = false
- end
- if x >= 2 and x <= 4 and y == 3 then
- set_cable("white")
- draw_screen()
- end
- if x >= 2 and x <= 4 and y == 5 then
- set_cable("orange")
- draw_screen()
- end
- if x >= 2 and x <= 4 and y == 7 then
- set_cable("magenta")
- draw_screen()
- end
- if x >= 2 and x <= 4 and y == 9 then
- set_cable("lightblue")
- draw_screen()
- end
- if x >= 2 and x <= 4 and y == 11 then
- set_cable("yellow")
- draw_screen()
- end
- if x >= 2 and x <= 4 and y == 13 then
- set_cable("lime")
- draw_screen()
- end
- if x >= 2 and x <= 4 and y == 15 then
- set_cable("pink")
- draw_screen()
- end
- if x >= 2 and x <= 4 and y == 17 then
- set_cable("gray")
- draw_screen()
- end
- if x >= 2 and x <= 4 and y == 19 then
- set_cable("lightgray")
- draw_screen()
- end
- if x >= 2 and x <= 4 and y == 21 then
- set_cable("cyan")
- draw_screen()
- end
- if x >= 2 and x <= 4 and y == 23 then
- set_cable("purple")
- draw_screen()
- end
- if x >= 25 and x <= 29 and y == 3 then
- set_cable("blue")
- draw_screen()
- end
- if x >= 25 and x <= 29 and y == 5 then
- set_cable("brown")
- draw_screen()
- end
- if x >= 25 and x <= 29 and y == 7 then
- set_cable("green")
- draw_screen()
- end
- if x >= 25 and x <= 29 and y == 9 then
- set_cable("red")
- draw_screen()
- end
- if x >= 25 and x <= 29 and y == 11 then
- set_cable("off")
- draw_screen()
- end
- if x >= 25 and x <= 29 and y == 13 then
- set_cable("on")
- draw_screen()
- end
- if x >= 25 and x <= 29 and y == 15 then
- set_cable("shutdown")
- draw_screen()
- end
- end
- if power == true then
- draw_screen()
- else
- shell.run("clear")
- end
- end
- --send cable data--
- function set_cable(data)
- modem.transmit(channel,backchan,data)
- end
- --program--
- set_monitor()
- draw_screen()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement