Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for k,v in pairs(rs.getSides()) do
- if peripheral.getType(v) == "monitor" then
- mon = peripheral.wrap(v)
- end
- end
- for k,v in pairs(rs.getSides()) do
- if peripheral.getType(v) == "modem" then
- rednet.open(v)
- end
- end
- function drawMon()
- mon.setBackgroundColor(colors.black)
- mon.clear()
- x,y = mon.getSize()
- buttonNo = 0
- for yc = y,1,-1 do
- buttonNo = buttonNo + 1
- if yc%2 == 1 then
- mon.setBackgroundColor(colors.purple)
- mon.setTextColor(colors.yellow)
- else
- mon.setBackgroundColor(colors.yellow)
- mon.setTextColor(colors.purple)
- end
- for xc = 1,x do
- mon.setCursorPos(xc, yc)
- mon.write(" ")
- end
- mon.setCursorPos(x/2+1,yc)
- mon.write(tostring(buttonNo))
- end
- end
- if fs.exists("floor") then
- file = fs.open("floor", "r")
- floor = file.readAll()
- file.close()
- else
- term.clear()
- term.setCursorPos(1,1)
- print("Which number will this be on the monitor?")
- write("> ")
- floor = read()
- file = fs.open("floor", "w")
- file.write(floor)
- file.close()
- term.clear()
- term.setCursorPos(1,1)
- print("Thank you.")
- sleep(1)
- term.clear()
- term.setCursorPos(1,1)
- end
- while true do
- drawMon()
- event, side, xTouch, yTouch =os.pullEvent("monitor_touch")
- buttonNo = y - yTouch + 1
- touchData = {
- sender = floor,
- destination = tostring(buttonNo)
- }
- rednet.broadcast(textutils.serialize(touchData), "teleport")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement