Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Command Remote for Network Control--
- -- MONITOR was CHANGED in monitor.cfg--
- --optimal monitor size 5*4--
- -- config--
- local channel = 43
- local backchan = 44
- modem = peripheral.wrap("back")
- local power = true
- local mon = ""
- local b1 = "Toggle Rain"
- local b2 = "Sunrise"
- local b3 = "Midday"
- local b4 = "Sunset"
- local b5 = "Midnight"
- local b6 = "zero hour"
- local b7 = "World survival"
- local b8 = "World creative"
- local b9 = "Set Block"
- local b10 = "Weather rain"
- local b11 = "Weather clear"
- local b12 = "Weather thunder"
- local b13 = "Shutdown"
- local b14 = "Give Item"
- local b15 = "Give XP"
- local b16 = "Gamemode"
- --var--
- local block = ""
- local give = ""
- local xp = ""
- local gm = ""
- --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
- --send data--
- function set_cable(data)
- modem.transmit(channel,backchan,data)
- 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("Command 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(b1)
- mon.setCursorPos(2,3)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(1,4)
- mon.write(b2)
- mon.setCursorPos(2,5)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(1,6)
- mon.write(b3)
- mon.setCursorPos(2,7)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(1,8)
- mon.write(b4)
- mon.setCursorPos(2,9)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(1,10)
- mon.write(b5)
- mon.setCursorPos(2,11)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(1,12)
- mon.write(b6)
- mon.setCursorPos(2,13)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(1,14)
- mon.write(b7)
- mon.setCursorPos(2,15)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(1,16)
- mon.write(b8)
- mon.setCursorPos(2,17)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(1,18)
- mon.write(b9)
- mon.setCursorPos(2,19)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(1,20)
- mon.write(b10)
- mon.setCursorPos(2,21)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(1,22)
- mon.write(b11)
- mon.setCursorPos(2,23)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(24,2)
- mon.write(b12)
- mon.setCursorPos(25,3)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(24,4)
- mon.write(b13)
- mon.setCursorPos(25,5)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(24,6)
- mon.write(b14)
- mon.setCursorPos(25,7)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(24,8)
- mon.write(b15)
- mon.setCursorPos(25,9)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(24,10)
- mon.write(b16)
- mon.setCursorPos(25,11)
- mon.setBackgroundColor(colors.gray)
- mon.write(" ")
- mon.setBackgroundColor(colors.white)
- touch()
- end
- -- input block--
- function input_block()
- mon.setBackgroundColor(colors.white)
- mon.setTextColor(colors.black)
- mon.setCursorPos(1,26)
- mon.write("X:")
- block = "setblock#"
- input = read()
- block = block..input.."#"
- mon.write("Y:")
- input = read()
- block = block..input.."#"
- mon.write("Z:")
- input = read()
- block = block..input.."#"
- mon.write("Block Name/ID:")
- input = read()
- block = block..input
- set_cable(block)
- draw_screen()
- end
- -- input give--
- function input_give()
- mon.setBackgroundColor(colors.white)
- mon.setTextColor(colors.black)
- mon.setCursorPos(1,26)
- mon.write("Player:")
- give = "give#"
- input = read()
- give = give..input.."#"
- mon.write("Block Name/ID:")
- input = read()
- give = give..input.."#"
- mon.write("Count:")
- input = read()
- give = give..input
- set_cable(give)
- draw_screen()
- end
- -- input xp--
- function input_xp()
- mon.setBackgroundColor(colors.white)
- mon.setTextColor(colors.black)
- mon.setCursorPos(1,26)
- mon.write("XP:")
- xp = "xp#"
- input = read()
- xp = xp..input.."#"
- mon.write("Player:")
- input = read()
- xp = xp..input
- set_cable(xp)
- draw_screen()
- end
- -- input gamemode--
- function input_gm()
- mon.setBackgroundColor(colors.white)
- mon.setTextColor(colors.black)
- mon.setCursorPos(1,26)
- mon.write("Modus:")
- gm = "gamemode#"
- input = read()
- gm = gm..input.."#"
- mon.write("Player:")
- input = read()
- gm = gm..input
- set_cable(gm)
- draw_screen()
- 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("rain")
- draw_screen()
- end
- if x >= 2 and x <= 4 and y == 5 then
- set_cable("sunrise")
- draw_screen()
- end
- if x >= 2 and x <= 4 and y == 7 then
- set_cable("midday")
- draw_screen()
- end
- if x >= 2 and x <= 4 and y == 9 then
- set_cable("sunset")
- draw_screen()
- end
- if x >= 2 and x <= 4 and y == 11 then
- set_cable("midnight")
- draw_screen()
- end
- if x >= 2 and x <= 4 and y == 13 then
- set_cable("zero_hour")
- draw_screen()
- end
- if x >= 2 and x <= 4 and y == 15 then
- set_cable("world_survival")
- draw_screen()
- end
- if x >= 2 and x <= 4 and y == 17 then
- set_cable("world_creative")
- draw_screen()
- end
- if x >= 2 and x <= 4 and y == 19 then
- input_block()
- end
- if x >= 2 and x <= 4 and y == 21 then
- set_cable("weather_rain")
- draw_screen()
- end
- if x >= 2 and x <= 4 and y == 23 then
- set_cable("weather_clear")
- draw_screen()
- end
- if x >= 25 and x <= 29 and y == 3 then
- set_cable("weather_thunder")
- draw_screen()
- end
- if x >= 25 and x <= 29 and y == 5 then
- set_cable("shutdown")
- draw_screen()
- end
- if x >= 25 and x <= 29 and y == 7 then
- input_give()
- end
- if x >= 25 and x <= 29 and y == 9 then
- input_xp()
- end
- if x >= 25 and x <= 29 and y == 11 then
- input_gm()
- end
- end
- if power == true then
- draw_screen()
- else
- shell.run("clear")
- end
- end
- --program--
- set_monitor()
- draw_screen()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement