Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("left")
- mon = periheral.wrap("bottom")
- incMessage = "false"
- function drawBackground()
- mon.setBackgroundColor(colors.black)
- mon.clear()
- x,y = mon.getSize()
- for yc = 1,y do
- if yc%2 == 1 then
- mon.setBackgroundColor(colors.red)
- else
- mon.setBackgroundColor(colors.orange)
- 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()
- if i%2 == 1 then
- mon.setBackgroundColor(colors.red)
- else
- mon.setBackgroundColor(colors.orange)
- end
- mon.setTextColor(colors.black)
- mon.setCursorPos(x/2 - string.len(label)/2, i)
- mon.write(label)
- end
- end
- end
- while true do
- drawBackground()
- drawButtons()
- term.clear()
- term.setCursorPos(1,1)
- print("Press any key to delete destinations")
- event, p1, p2, p3 =os.pullEvent()
- if event == "Monitor_touch" then
- if fs.exists(p2) then
- file = fs.open(p2, "r")
- newMessage = file.read()
- file.close()
- rednet.broadcast(newMessage, "tele")
- incID, incMessage = rednet.receive("tele", 1)
- if incMessage == "true" then
- turtle.select(1)
- turtle.drop()
- sleep(5)
- turtle.suck()
- else
- mon.clear()
- mon.setCursorPos(1,1)
- mon.write("No active")
- mon.setCursorPos(1,3)
- mon.write("portal")
- sleep(1)
- end
- incMessage = "false"
- else
- mon.clear()
- mon.setCursorPos(1,1)
- mon.write("Not Set")
- sleep(1)
- end
- elseif event == "turtle_inventory" then
- itemData = turtle.getItemDetail(16)
- if itemData <> nil then
- newDestination = itemData.name
- end
- findBlank = 1
- while fs.exists(findBlank) = true do
- findBlank = findBlank + 1
- end
- fs.open(tostring(findBlank), "w")
- file.write(newDestination)
- file.close()
- elseif event == "key" then
- print("counting down from the top, enter the number of the line to delete.")
- term.write(">")
- toDelete = read()
- fs.delete(toDelete)
- end
- end
Add Comment
Please, Sign In to add comment