Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mon = peripheral.find("monitor")
- rednet.open("right") --possibly "wireless_modem"?
- Rside = "back" -- set redstone output side
- function drawBackground()
- mon.setBackgroundColor(colors.black)
- mon.clear()
- mon.setTextColor(colors.black)
- x,y = mon.getSize()
- for yc = 1,15 do
- if yc%2 == 1 then
- mon.setBackgroundColor(colors.lightBlue)
- else
- mon.setBackgroundColor(colors.lightGray)
- end
- for xc = 1,x do
- mon.setCursorPos(xc, yc)
- mon.write(" ")
- end
- mon.setCursorPos(x/2,yc)
- mon.write(yc)
- end
- end
- function drawButtons()
- x,y = mon.getSize()
- for i=1,y do
- if fs.exists(tostring(i)) then
- file = fs.open(tostring(i), "r")
- label = file.readAll()
- file.close()
- mon.setCursorPos(x/2, i)
- if i%2 == 1 then
- mon.setBackgroundColor(colors.lightBlue)
- else
- mon.setBackgroundColor(colors.lightGray)
- end
- mon.setTextColor(colors.white)
- mon.write(i)
- mon.setCursorPos(x/2, i)
- end
- end
- end
- if fs.exists("level") == false then
- print("What level is this?")
- write("> ")
- level = read()
- term.clear()
- term.setCursorPos(1,1)
- file = fs.open("level", "w")
- file.write(level)
- file.close()
- else
- file = fs.open("level", "r")
- level = file.readAll()
- file.close()
- end
- drawBackground()
- drawButtons()
- while true do
- event, param1, param2, param3 = os.pullEvent()
- if event == "rednet_message" then
- if tonumber(param2) == tonumber(level) then
- print("inc")
- rs.setOutput(Rside,true)
- else
- rs.setOutput(Rside, false)
- end
- elseif event == "monitor_touch" then
- if tonumber(param3) == tonumber(level) then
- rs.setOutput(Rside, true)
- rednet.broadcast(param3)
- else
- rednet.broadcast(param3)
- rs.setOutput(Rside, false)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement