Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mon = peripheral.wrap("right")
- term.redirect(mon)
- width, height = term.getSize()
- rednet.open("left")
- dl = {}
- --------------------------------------------
- function setColor(text, background)
- term.setTextColor(text)
- term.setBackgroundColor(background)
- end
- function drawImage(image, x, y)
- myImage = paintutils.loadImage(image)
- paintutils.drawImage(myImage, x, y)
- end
- function writeFile()
- handle = fs.open("dayOrNight", "w")
- handle.write(time)
- handle.close()
- end
- function loadFile()
- handle = fs.open("dayOrNight", "r")
- time = handle.readLine()
- handle.close()
- 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 drawScreen()
- backgroundColor(colors.lightBlue)
- drawImage("buttonOn", 3,2)
- drawImage("buttonOn", 16,2)
- drawImage("buttonOn", 3,6)
- drawImage("buttonOn", 16,6)
- drawImage("messageScreen", 2, 10)
- end
- function drawButtons()
- drawImage("buttonOn", 3,2)
- drawImage("buttonOn", 16,2)
- drawImage("buttonOn", 3,6)
- drawImage("buttonOn", 16,6)
- end
- function text()
- mWrite("New mine", 5, 3, colors.lime, colors.black)
- mWrite("Download", 5, 7, colors.lime, colors.black)
- mWrite("Pastebin", 18, 3, colors.lime, colors.black)
- mWrite("Go to", 19, 7, colors.lime, 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 = 10
- end
- mWrite(mes, 3, tY, colors.black, colors.white)
- tY = tY + 1
- elseif event == "monitor_touch" and mes > 1 and mes < 14 and dis > 1 and dis < 5 then newMine()
- elseif event == "monitor_touch" and mes > 14 and mes < 27 and dis > 1 and dis < 5 then pastebin()
- elseif event == "monitor_touch" and mes > 1 and mes < 14 and dis > 5 and dis < 9 then download()
- elseif event == "monitor_touch" and mes > 14 and mes < 27 and dis > 5 and dis < 9 then goTo()
- end
- end
- function newMine()
- rednet.broadcast("new")
- drawButtons()
- mWrite("Sending", 5, 3, colors.lime, colors.black)
- mWrite("Download", 5, 7, colors.lime, colors.black)
- mWrite("Pastebin", 18, 3, colors.lime, colors.black)
- mWrite("Go to", 19, 7, colors.lime, colors.black)
- sleep(1)
- --mon.clear()
- drawButtons()
- text()
- --tY = 10
- end
- function download()
- rednet.broadcast("download")
- drawButtons()
- mWrite("New mine", 5, 3, colors.lime, colors.black)
- mWrite("Sending", 6, 7, colors.lime, colors.black)
- mWrite("Pastebin", 18, 3, colors.lime, colors.black)
- mWrite("Go to", 19, 7, colors.lime, colors.black)
- sleep(1)
- --mon.clear()
- drawButtons()
- text()
- --tY = 10
- end
- function pastebin()
- rednet.broadcast("pastebin")
- mon.clear()
- drawScreen()
- mWrite("New mine", 5, 3, colors.lime, colors.black)
- mWrite("Download", 5, 7, colors.lime, colors.black)
- mWrite("Sending", 18, 3, colors.lime, colors.black)
- mWrite("Go to", 19, 7, colors.lime, colors.black)
- mWrite("Enter pastebin code", (width/2)-8, 15, colors.black, colors.white)
- term.setCursorPos((width/2)-2, 16)
- code = io.read()
- mon.clear()
- drawScreen()
- mWrite("New mine", 5, 3, colors.lime, colors.black)
- mWrite("Download", 5, 7, colors.lime, colors.black)
- mWrite("Sending", 18, 3, colors.lime, colors.black)
- mWrite("Go to", 19, 7, colors.lime, colors.black)
- mWrite("Enter name for file", (width/2)-8, 15, colors.black, colors.white)
- term.setCursorPos((width/2)-2, 16)
- name = io.read()
- dl["placement"] = name
- dl["fileName"] = code
- pastebin = textutil.serialize(dl)
- rednet.broadcast(pastebin)
- sleep(1)
- --mon.clear()
- drawButtons()
- text()
- --tY = 10
- end
- function goTo()
- rednet.broadcast("go up")
- mon.clear()
- drawScreen()
- mWrite("New mine", 5, 3, colors.lime, colors.black)
- mWrite("Download", 5, 7, colors.lime, colors.black)
- mWrite("Pastebin", 18, 3, colors.lime, colors.black)
- mWrite("Sending", 18, 7, colors.lime, colors.black)
- mWrite("Enter Y level to go to", (width/2)-11, 15, colors.black, colors.white)
- term.setCursorPos((width/2)-11, 16)
- level = io.read()
- rednet.broadcast(level)
- sleep(1)
- --mon.clear()
- drawButtons()
- text()
- --tY = 10
- end
- --------------------------------------------------
- tY = 10
- drawScreen()
- text()
- while true do
- wait()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement