Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mon = peripheral.find("monitor")
- for k,v in pairs(rs.getSides()) do
- if peripheral.getType(v) == "modem" then
- rednet.open(v)
- end
- end
- freqRange = 60 --If you want a second network or other people are using ender chests used by this program you can change this number. Must be the same on all computers on this network.
- ECInput = peripheral.wrap("top")
- ECOutput = peripheral.wrap("bottom")
- ioPort = peripheral.wrap("right")
- 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.purple)
- else
- mon.setBackgroundColor(colors.magenta)
- end
- for xc = 1,x do
- mon.setCursorPos(xc, yc)
- mon.write(" ")
- end
- end
- end
- function inputPage(level)
- mon.clear()
- mon.setBackgroundColor(colors.pink)
- mon.setCursorPos(1, 1)
- mon.write("go to")
- mon.setCursorPos(1, 2)
- mon.write("computer")
- term.clear()
- x,y = term.getSize()
- term.setCursorPos(x/2-8, y/2-2)
- print("Enter Name")
- term.setCursorPos(2, y/2)
- print(" ")
- term.setCursorPos(2, y/2)
- label = read()
- term.setBackgroundColor(colors.black)
- term.clear()
- file = fs.open(tostring(param3), "w")
- file.write(label)
- file.close()
- 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 - string.len(label)/2, i)
- if i%2 == 1 then
- mon.setBackgroundColor(colors.purple)
- else
- mon.setBackgroundColor(colors.magenta)
- end
- mon.setTextColor(colors.white)
- mon.write(label)
- mon.setCursorPos(x, i)
- mon.setBackgroundColor(colors.black)
- mon.setTextColor(colors.white)
- mon.write("X")
- end
- end
- end
- if fs.exists("freq") then --
- file = fs.open("freq", "r")
- freq = file.readAll()
- file.close()
- else
- mon.clear()
- mon.setCursorPos(1,1)
- mon.write("GO TO")
- mon.setCursorPos(1,1)
- mon.write("COMPUTER")
- term.clear()
- term.setCursorPos(1,1)
- print("Enter a unique number for where you want this pad to appear on the touchscreen. 1 is the top of the screen:")
- write("> ")
- freq = read()
- file = fs.open("freq", "w")
- file.write(freq)
- file.close()
- end
- if fs.exists("incCheck") == false then
- print("Installing IncCheck")
- shell.run("pastebin get zLBpFvAn incCheck")
- end
- ECInput.setFrequency(freq + freqRange)
- ECOutput.setFrequency(freqRange)
- mon.clear()
- drawBackground()
- drawButtons()
- shell.openTab("incCheck")
- while true do
- x,y=mon.getSize()
- event, param1, param2, param3, param4 = os.pullEvent() --destination selected or new destination being set
- if event == "monitor_touch" and param2 < x then
- if fs.exists(tostring(param3)) then -- existing destination selected
- rednet.broadcast("up",freq)
- ECInput.setFrequency(freqRange)
- ECOutput.setFrequency(param3 + freqRange)
- ECOutput.pullItem("west",1,1,1)
- os.sleep(.2)
- ECOutput.pushItem("west",1)
- if ECInput.pushItem("East",1) == 1 then
- var = ioPort.getStackInSlot(2)
- while var == nil do
- rs.setAnalogOutput("right", 1)
- sleep(0.5)
- rs.setOutput("right", false)
- var = ioPort.getStackInSlot(2)
- print("Attempting to deploy image")
- sleep(0.5)
- end
- rednet.broadcast("down",freq)
- ioPort.pushItem("down", 2)
- ECInput.setFrequency(freqRange + freq)
- var = ECOutput.getStackInSlot(1)
- while var ~= nil do
- sleep(0.1)
- var = ioPort.getStackInSlot(1)
- end
- ECOutput.setFrequency(freqRange)
- else
- mon.clear()
- mon.setCursorPos(1,1)
- mon.write("No Drive")
- sleep(1)
- end
- else -- user selected blank part of the screen and wants to add new destination
- inputPage(param3)
- end
- mon.clear()
- drawBackground()
- drawButtons()
- elseif event == "modem_message" and param4.message == "freq" then -- frequency requested from PylonCom
- sleep(.1)
- rednet.send(param3, freq)
- elseif event == "monitor_touch" then
- fs.delete(tostring(param3))
- mon.clear()
- drawBackground()
- drawButtons()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement