Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mon = peripheral.wrap("top")
- term.redirect(mon)
- width, height = term.getSize()
- rednet.open("left")
- tY = 5
- mon.clear()
- function setColor(text, background)
- term.setTextColor(text)
- term.setBackgroundColor(background)
- end
- function mWrite(message, cX, cY, background, text)
- mon.setBackgroundColor(background)
- if text == nil then mon.setTextColor(colors.black)
- else mon.setTextColor(text)
- end
- mon.setCursorPos(cX, cY)
- mon.write(message)
- end
- function backgroundColor(color)
- mon.setBackgroundColor(color)
- mon.clear()
- end
- function text()
- mWrite("New mine", 5, 3, colors.lime, colors.black)
- mWrite("Download", 18, 3, colors.red, colors.black)
- end
- function wait()
- event, sid, mes, dis = os.pullEvent()
- if event == "rednet_message" then
- if tY == 20 then
- mon.clear()
- -- drawScreen()
- text()
- tY = 5
- end
- mWrite(mes, 3, tY, colors.black, colors.white)
- tY = tY + 1
- elseif event == "monitor_touch" and mes > 1 and mes < 14 then newMine()
- elseif event == "monitor_touch" and mes > 14 and mes < 27 then download()
- end
- end
- function newMine()
- rednet.broadcast("go")
- sleep(1)
- mon.setBackgroundColor(colors.black)
- mon.clear()
- mWrite("1", 5, 3, colors.lime, colors.black)
- mWrite("2", 18, 3, colors.lime, colors.black)
- mWrite("3", 5, 10, colors.lime, colors.black)
- mWrite("4", 18, 10, colors.lime, colors.black)
- event, niu, argX, argY = os.pullEvent("monitor_touch")
- if argX > 0 and argX < 14 and argY > 0 and argY <7 then message = 1
- elseif argX > 14 and argX < 27 and argY > 0 and argY < 7 then message = 2
- elseif argX > 0 and argX < 14 and argY > 7 and argY <30 then message = 3
- elseif argX > 14 and argX < 27 and argY > 7 and argY <30 then message = 4
- end
- print(message)
- sleep(1)
- rednet.broadcast(message)
- mon.setBackgroundColor(colors.black)
- mon.clear()
- end
- function download()
- rednet.broadcast("download")
- mon.setBackgroundColor(colors.black)
- mon.clear()
- end
- while true do
- text()
- wait()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement