Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- side = "back"
- m = peripheral.wrap(side)
- m.setTextColor(colors.white)
- on = false
- rednet.open("right")
- open = false
- m.clear()
- m.setTextScale(2)
- function set_screen()
- if on and open then
- m.setCursorPos(1,4)
- m.clearLine()
- m.write(" [On] [Open]")
- elseif on and not open then
- m.setCursorPos(1,4)
- m.clearLine()
- m.write(" [On] [Close]")
- elseif not on and not open then
- m.setCursorPos(1,4)
- m.clearLine()
- m.write(" [Off] [Close]")
- elseif not on and open then
- m.setCursorPos(1,4)
- m.clearLine()
- m.write(" [Off] [Open]")
- else
- m.setCursorPos(1,4)
- m.clearLine()
- m.write("Unexpected State Combination")
- end
- m.setCursorPos(10,4)
- m.write(xp_levels)
- end
- function set_rs()
- if on and open then
- rs.setBundledOutput("bottom",colors.red)
- elseif on and not open then
- rs.setBundledOutput("bottom",colors.combine(colors.lime,colors.red))
- elseif not on and not open then
- rs.setBundledOutput("bottom",colors.lime)
- elseif not on and open then
- rs.setBundledOutput("bottom",colors.cyan)
- end
- end
- function set_states(arg1, arg2, arg3)
- if (arg2>=2) and (arg2<=4) and (arg3==4) then
- on = not on
- elseif (arg2>=15) and (arg2<=23) and (arg3==4) then
- if on then
- open = false
- else
- open = true
- end
- end
- end
- --{base of program
- m.setCursorPos(1,1)
- m.write(" -=[Spawning]=- ")
- m.setCursorPos(1,3)
- m.write(" Spawner XP Hactches")
- while true do
- event, arg1, arg2, arg3 = os.pullEvent()
- if event == "rednet_message" then
- xp_levels = arg2 -- the message is arg2
- elseif event == "monitor_touch" then
- set_states(arg1, arg2, arg3) -- send the side, x, and y to the function
- end
- set_screen()
- set_rs()
- end
Advertisement
Add Comment
Please, Sign In to add comment