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
- side = v
- mon = peripheral.wrap(side)
- break
- end
- end
- for k,v in pairs(rs.getSides()) do
- if peripheral.getType(v)=='modem' then
- rednet.open(v)
- break
- end
- end
- monX, monY = mon.getSize()
- portal = "n"
- launch = false
- update = false
- x = 0
- y = 0
- z = 0
- setX = 0
- setY = 0
- setZ = 0
- local function link()
- mon.setCursorPos(1,1)
- mon.setBackgroundColor(colors.black)
- mon.clear()
- mon.setBackgroundColor(colors.green)
- for i = 1,monY,2 do
- mon.setCursorPos(1,i)
- for k = 1,monX do
- mon.write(" ")
- end
- end
- mon.setBackgroundColor(colors.lime)
- for i = 2,monY,2 do
- mon.setCursorPos(1,i)
- for k = 1,monX do
- mon.write(" ")
- end
- end
- for i = 2, monY,2 do
- if fs.exists(tostring(i.."prt")) then
- file = fs.open(tostring(i.."prt"),"r")
- data = file.readAll()
- file.close()
- data = textutils.unserialize(data)
- for key,value in pairs(data) do
- if tostring(key) == "name" then
- mon.setCursorPos(monX/2-string.len(tostring(value))/2, i)
- mon.write(tostring(value))
- end
- end
- else
- mon.setCursorPos(monX/2-7, i)
- mon.write("Set Portal Link")
- end
- end
- mon.setBackgroundColor(colors.red)
- for i = 1,monY do
- mon.setCursorPos(monX-3,i)
- mon.write(" X ")
- end
- mon.setBackgroundColor(colors.green)
- for i = 1, monY,2 do
- if fs.exists(tostring(i.."prt")) then
- file = fs.open(tostring(i.."prt"),"r")
- data = file.readAll()
- file.close()
- data = textutils.unserialize(data)
- for key,value in pairs(data) do
- if tostring(key) == "name" then
- mon.setCursorPos(monX/2-string.len(tostring(value))/2, i)
- mon.write(tostring(value))
- end
- end
- else
- mon.setCursorPos(monX/2-7, i)
- mon.write("Set Portal Link")
- end
- end
- event, param1, param2, param3 = os.pullEvent("monitor_touch")
- if param2 > monX-3 then
- fs.delete(tostring(param3.."prt"))
- elseif fs.exists(tostring(param3.."prt")) then
- rednet.send(tonumber(linkTurtle), param3)
- id = nil
- while id ~= tonumber(linkTurtle) do
- id, message = rednet.receive()
- end
- if message == "true" then
- mon.setBackgroundColor(colors.black)
- mon.setTextColor(colors.yellow)
- mon.clear()
- mon.setCursorPos(monX/2-8, monY/2)
- mon.write("Link Book changed")
- mon.setCursorPos(monX/2-12, monY/2+2)
- mon.write("Reset target coordinates!")
- file = fs.open(tostring(param3.."prt"), "r")
- info = file.readAll()
- file.close()
- info = textutils.unserialize(info)
- for key, value in pairs(info) do
- if key == "x" then
- prtX = value
- elseif key == "y" then
- prtY = value
- elseif key == "z" then
- prtZ = value
- end
- end
- update = true
- adjX = (locX - prtX)
- adjY = (locY - prtY)
- adjZ = (locZ - prtZ)
- file = fs.open("adj","w")
- file.write(param3.."prt")
- file.close()
- adj = param3.."prt"
- sleep(2.5)
- elseif message == "false" then
- mon.setBackgroundColor(colors.black)
- mon.setTextColor(colors.red)
- mon.clear()
- mon.setCursorPos(monX/2-15, monY/2)
- mon.write("Turtle unable to change Link Book")
- sleep(5)
- end
- mon.clear()
- else
- mon.setBackgroundColor(colors.black)
- mon.setTextColor(colors.green)
- mon.clear()
- mon.setCursorPos(monX/2-15, monY/2)
- mon.write("Follow Prompts On The Computer Bellow")
- term.clear()
- term.setCursorPos(1,1)
- for i = 1, monY do
- if fs.exists(tostring(i.."prt")) then
- tSlot = i
- end
- end
- tSlot = tSlot + 1
- print("When linking the Linking Book face north. Then place Linking book in slot "..tSlot.." of your turtle positioned above the portal receptacle. Press Enter to continue. ")
- dud = read()
- term.clear()
- term.setCursorPos(1,1)
- write("Set the display name for Link: ")
- name = read()
- term.clear()
- term.setCursorPos(1,1)
- write("Set the X coordinate of Link location: ")
- adjX = read()
- term.clear()
- term.setCursorPos(1,1)
- write("Set the Y coordinate of Link location: ")
- adjY = read()
- term.clear()
- term.setCursorPos(1,1)
- write("Set the Z coordinate of Link location: ")
- adjZ = read()
- table = {name = name, x = adjX, y = adjY, z = adjZ}
- table = textutils.serialize(table)
- for i = 1, monY do
- if fs.exists(tostring(i.."prt")) == false then
- file = fs.open(tostring(i.."prt"), "w")
- file.write(table)
- file.close()
- adj = i.."prt"
- file = fs.open("adj", "w")
- file.write(adj)
- file.close()
- break
- end
- end
- rednet.send(tonumber(linkTurtle), tostring(tSlot))
- while waitID ~= tonumber(linkTurtle) do
- term.clear()
- term.setCursorPos(1,1)
- print("Waiting for Turtle.")
- waitID, message = rednet.receive(5)
- end
- if message ~= "true" then
- print("Turtle cannot place book. Deleting link.")
- sleep(10)
- fs.delete(tostring(tSlot.."prt"))
- end
- end
- update = true
- display()
- end
- local function bookmarks()
- mon.setCursorPos(1,1)
- mon.setBackgroundColor(colors.black)
- mon.clear()
- mon.setBackgroundColor(colors.green)
- for i = 1,monY,2 do
- mon.setCursorPos(1,i)
- for k = 1,monX do
- mon.write(" ")
- end
- end
- mon.setBackgroundColor(colors.lime)
- for i = 2,monY,2 do
- mon.setCursorPos(1,i)
- for k = 1,monX do
- mon.write(" ")
- end
- end
- for i = 2, monY,2 do
- if fs.exists(tostring(i)) then
- file = fs.open(tostring(i),"r")
- data = file.readAll()
- file.close()
- data = textutils.unserialize(data)
- for key,value in pairs(data) do
- if tostring(key) == "name" then
- mon.setCursorPos(monX/2-string.len(tostring(value))/2, i)
- mon.write(tostring(value))
- end
- end
- else
- mon.setCursorPos(monX/2-5, i)
- mon.write("Set Bookmark")
- end
- end
- mon.setBackgroundColor(colors.red)
- for i = 1,monY do
- mon.setCursorPos(monX-3,i)
- mon.write(" X ")
- end
- mon.setBackgroundColor(colors.green)
- for i = 1, monY,2 do
- if fs.exists(tostring(i)) then
- file = fs.open(tostring(i),"r")
- data = file.readAll()
- file.close()
- data = textutils.unserialize(data)
- for key,value in pairs(data) do
- if tostring(key) == "name" then
- mon.setCursorPos(monX/2-string.len(tostring(value))/2, i)
- mon.write(tostring(value))
- end
- end
- else
- mon.setCursorPos(monX/2-5, i)
- mon.write("Set Bookmark")
- end
- end
- event, param1, param2, param3 = os.pullEvent("monitor_touch")
- if param2 > monX-3 then
- fs.delete(tostring(param3))
- elseif fs.exists(tostring(param3)) then
- file = fs.open(tostring(param3), "r")
- info = file.readAll()
- file.close()
- info = textutils.unserialize(info)
- for key, value in pairs(info) do
- if key == "x" then
- setX = value
- elseif key == "y" then
- setY = value
- elseif key == "z" then
- setZ = value
- end
- update = true
- end
- mon.clear()
- else
- mon.setBackgroundColor(colors.black)
- mon.setTextColor(colors.green)
- mon.clear()
- mon.setCursorPos(monX/2-15, monY/2)
- mon.write("Follow Prompts On The Computer Bellow")
- term.clear()
- term.setCursorPos(1,1)
- write("Set the name for bookmark: ")
- name = read()
- term.clear()
- term.setCursorPos(1,1)
- write("Set the X coordinate: ")
- wpX = read()term.clear()
- term.setCursorPos(1,1)
- write("Set the Y coordinate: ")
- wpY = read()term.clear()
- term.setCursorPos(1,1)
- write("Set the Z coordinate: ")
- wpZ = read()
- term.clear()
- term.setCursorPos(1,1)
- write("Done!")
- table = {name = name, x = wpX, y = wpY, z = wpZ}
- table = textutils.serialize(table)
- for i = 1, monY do
- if fs.exists(tostring(i)) == false then
- file = fs.open(tostring(i), "w")
- file.write(table)
- file.close()
- break
- end
- end
- end
- display()
- end
- local function coords()
- mon.setTextScale(1)
- mon.setTextColor(colors.yellow)
- mon.setBackgroundColor(colors.black)
- if portal == "y" then
- for i = 1, monX do
- mon.setCursorPos(i,1)
- mon.write(" ")
- end
- mon.setCursorPos(1,1)
- mon.write("X: "..x-adjX)
- mon.setCursorPos(monX/2-2,1)
- mon.write("Y: "..y-adjY)
- mon.setCursorPos(monX-8,1)
- mon.write("Z: "..z-adjZ)
- dist = math.floor(math.sqrt( (x-locX-adjX)^2 + (y-locY-adjY)^2 + (z-locZ-adjZ)^2 ))
- for i = 1, monX do
- mon.setCursorPos(i,3)
- mon.write(" ")
- end
- for i = monY/4, monY/4+2 do
- for k = 1, monX do
- mon.setCursorPos(k,i)
- mon.write(" ")
- end
- end
- if fs.exists(adj) then
- file = fs.open(adj, "r")
- info = textutils.unserialize(file.readAll())
- file.close()
- else
- file = fs.open("0prt", "r")
- info = textutils.unserialize(file.readAll())
- file.close()
- end
- for key, value in pairs(info) do
- if key == "name" then
- linkB = value
- end
- end
- mon.setCursorPos((monX/2) - (string.len("Using Link: "..linkB)/2), 3)
- mon.write("Using Link: "..linkB)
- mon.setCursorPos((monX/2)-(string.len("Distance: "..dist)/2), monY/4+1) --fix
- mon.write("Distance: "..dist)
- if adj == "0prt" then
- dist = "No link Set"
- else
- dist = math.floor(math.sqrt( (x-locX)^2 + (y-locY)^2 + (z-locZ)^2 ))
- end
- mon.setCursorPos((monX/2)-(string.len("Distance from link: "..dist)/2), monY/4+2) --fix
- mon.write("Distance from link: "..dist)
- else
- for i = 1, monX do
- mon.setCursorPos(i,1)
- mon.write(" ")
- end
- mon.setCursorPos(1,1)
- mon.write("X: "..x)
- mon.setCursorPos(monX/2-2,1)
- mon.write("Y: "..y)
- mon.setCursorPos(monX-8,1)
- mon.write("Z: "..z)
- dist = math.floor(math.sqrt( (x-locX)^2 + (y-locY)^2 + (z-locZ)^2 ))
- for i = 1, monX do
- mon.setCursorPos(i,monY/4)
- mon.write(" ")
- end
- for i = 1, monX do
- mon.setCursorPos(i,monY/4+1)
- mon.write(" ")
- end
- mon.setCursorPos((monX/2)-(string.len("Distance: "..dist)/2), monY/4+1) --fix
- mon.write("Distance: "..dist)
- end
- end
- function display()
- mon.setTextScale(1)
- mon.setTextColor(colors.yellow)
- mon.setBackgroundColor(colors.black)
- mon.clear()
- coords()
- if portal == "y" then
- mon.setTextColor(colors.black)
- mon.setBackgroundColor(colors.yellow)
- for k = monY/4*2+1, monY do
- for i = 1, monX/5*2 do
- mon.setCursorPos(i, k)
- mon.write(" ")
- end
- end
- mon.setCursorPos(monX/10+2, monY/8*5+1)
- mon.write("Bookmarks")
- mon.setTextColor(colors.black)
- mon.setBackgroundColor(colors.orange)
- for k = monY/4*3+1, monY do
- for i = 1, monX/5*2 do
- mon.setCursorPos(i, k)
- mon.write(" ")
- end
- end
- mon.setCursorPos(monX/10+4, monY/8*7+1)
- mon.write("Links")
- mon.setBackgroundColor(colors.black)
- for k = monY/4*3+1, monY do
- for i = ((monX/5*2)/8*7)+1, monX/5*2+1 do
- mon.setCursorPos(i, k)
- mon.write(" ")
- end
- end
- mon.setCursorPos(((monX/5*2)/8*7)+2, monY/4*3+2)
- mon.setTextColor(colors.orange)
- mon.write("X")
- else
- mon.setTextColor(colors.black)
- mon.setBackgroundColor(colors.yellow)
- for k = monY/2+1, monY do
- for i = 1, monX/5*2 do
- mon.setCursorPos(i, k)
- mon.write(" ")
- end
- end
- mon.setCursorPos(monX/10, monY/4*3+1)
- mon.write("Bookmarks")
- end
- mon.setBackgroundColor(colors.red)
- for k = monY/2+1, monY do
- for i = monX/5*2+1, monX/5*3 do
- mon.setCursorPos(i, k)
- mon.write(" ")
- end
- end
- mon.setCursorPos(monX/2-2, monY/4*3+1)
- mon.setTextColor(colors.yellow)
- mon.write("Launch")
- mon.setBackgroundColor(colors.yellow)
- for k = monY/2+1, monY do
- for i = monX/5*3+1, monX do
- mon.setCursorPos(i,k)
- mon.write(" ")
- end
- end
- mon.setCursorPos(monX/5*4-7, monY/8*5+1)
- mon.setTextColor(colors.black)
- mon.write(" Set Coordinates")
- mon.setTextColor(colors.black)
- mon.setBackgroundColor(colors.orange)
- for k = monY/4*3+1, monY do
- for i = monX/5*3+1, monX do
- mon.setCursorPos(i, k)
- mon.write(" ")
- end
- end
- mon.setCursorPos((monX/5*4)-(string.len("Manage Missiles")/2)+2, monY/8*7+1)
- mon.write("Manage Missiles")
- end
- if fs.exists("location") then
- file = fs.open("location","r")
- loc = file.readAll()
- file.close()
- loc = textutils.unserialize(loc)
- for key,value in pairs(loc) do
- if tostring(key) == "x" then
- locX = tonumber(value)
- elseif tostring(key) == "y" then
- locY = tonumber(value)
- elseif tostring(key) == "z" then
- locZ = tonumber(value)
- end
- end
- file = fs.open("icbmCom", "r")
- icbm = tonumber(file.readAll())
- file.close()
- if fs.exists("adj") then
- portal = "y"
- file = fs.open("adj","r")
- adj = file.readAll()
- file.close()
- if fs.exists(adj) then
- file = fs.open(adj, "r")
- linkxyz = file.readAll()
- file.close()
- else
- file = fs.open("0prt", "r")
- linkxyz = file.readAll()
- file.close()
- end
- linkxyz = textutils.unserialize(linkxyz)
- for key,value in pairs(linkxyz) do
- if tostring(key) == "x" then
- adjX = tonumber(value)
- elseif tostring(key) == "y" then
- adjY = tonumber(value)
- elseif tostring(key) == "z" then
- adjZ = tonumber(value)
- end
- end
- file = fs.open("linkTurtle", "r")
- linkTurtle = tonumber(file.readAll())
- file.close()
- end
- file = fs.open("icbmCom", "r")
- icbm = tonumber(file.readAll())
- file.close()
- file = fs.open("missileTurtle", "r")
- missileTurtle = tonumber(file.readAll())
- file.close()
- else
- mon.clear()
- mon.setCursorPos(monX/2 - 16, monY/2)
- mon.write("Follow instructions on computer below")
- term.clear()
- term.setCursorPos(1,1)
- write("Enter the Launcher's X coordinate: ")
- locX = read()
- write("Enter the Launcher's Y (height) coordinate: ")
- locY = read()
- write("Enter the Launcher's Z coordinate: ")
- locZ = read()
- term.clear()
- term.setCursorPos(1,1)
- print("Place an Advanced Turtle on top of the launchers middle bottom block so it sits inside in the launcher in the middle (missiles will fire through the turtle) and install the missileTurtle Program on the turtle (Type: pastebin get <inset URL> startup) and run it by typing: startup")
- print("Once the missileTurtle program is running press Enter")
- read()
- term.clear()
- term.setCursorPos(1,1)
- write("Now enter the ID of the Missile Turtle: ")
- missileTurtle = tonumber(read())
- file = fs.open("missileTurtle", "w")
- file.write(missileTurtle)
- file.close()
- while true do
- write("Are you launching through a portal? (y/n): ")
- portal = read()
- if portal == "y" or portal == "n" then
- break
- end
- end
- if portal == "y" then
- term.clear()
- term.setCursorPos(1,1)
- print("While facing north the whole time, build a portal horizontally on top of the launcher so the missile will travel through it. Place the book receptacle then place a turtle on top of the receptacle. You may now stop facing north.")
- print("Press enter to continue")
- read()
- term.clear()
- term.setCursorPos(1,1)
- print("Now install the linkTurtle Program on the turtle (Type: pastebin get T1H2HFMx startup) and run it by typing: startup. Then enter this computer's ID in to the turtle.")
- print("Once the turtle program is running press Enter to continue.")
- read()
- write("Enter the ID of the Linkbook Turtle: ")
- linkTurtle = tonumber(read())
- file = fs.open("linkTurtle", "w")
- file.write(linkTurtle)
- file.close()
- write("Enter a display name for the Linking Book: ")
- name = read()
- write("Enter linking book's X coordinate: ")
- prtX = read()
- write("Enter linking book's Y coordinate: ")
- prtY = read()
- write("Enter linking book's Z coordinate: ")
- prtZ = read()
- term.clear()
- term.setCursorPos(1,1)
- print("How many blocks above the base of the launcher is the portal?")
- prtY = prtY + read()
- adjX = (locX - prtX)
- adjY = (locY - prtY)
- adjZ = (locZ - prtZ)
- linkxyz = {name = name, x = prtX, y = prtY, z = prtZ}
- linkxyz = textutils.serialize(linkxyz)
- adj = "1prt"
- file = fs.open("adj", "w")
- file.write(adj)
- file.close()
- file = fs.open("1prt", "w")
- file.write(linkxyz)
- file.close()
- term.clear()
- term.setCursorPos(1,1)
- end
- location = {x = locX, y = locY, z = locZ}
- location = textutils.serialize(location)
- file = fs.open("location", "w")
- file.write(location)
- file.close()
- term.clear()
- term.setCursorPos(1,1)
- write("Enter the ID the ICBM launcher computer: ")
- icbm = tonumber(read())
- file = fs.open("icbmCom", "w")
- file.write(icbm)
- file.close()
- term.clear()
- term.setCursorPos(1,1)
- print("Setup Complete!")
- sleep(2)
- end
- display()
- while true do
- event, param1, param2, param3, param4, param5 = os.pullEvent()
- print(event)
- if event == "modem_message" and param3 == icbm then
- rednet.send(icbm, "ok1")
- id, x = rednet.receive()
- print("x: "..x)
- rednet.send(icbm, "ok2")
- id, y =rednet.receive()
- print("y: "..y)
- rednet.send(icbm, "ok3")
- id, z = rednet.receive()
- print("Z: "..z)
- if launch == true then
- rednet.send(icbm, "launch")
- launch = false
- elseif update == true then
- print("sending update!")
- if portal == "y" then
- print(setX)
- print(adjX)
- setX = setX + adjX
- setY = setY + adjY
- setZ = setZ + adjZ
- end
- rednet.send(icbm, "coords")
- rednet.receive()
- rednet.send(icbm, setX)
- rednet.receive()
- rednet.send(icbm, setY)
- rednet.receive()
- rednet.send(icbm, setZ)
- update = false
- else
- rednet.send(icbm, "dud")
- end
- coords()
- elseif event == "monitor_touch" and param2 > monX/5*3+1 and param3 > monY/2 and param3 < monY/4*3+1 then
- mon.setBackgroundColor(colors.black)
- mon.clear()
- coords()
- mon.setCursorPos(monX/2- 14, monY/2)
- mon.setTextColor(colors.red)
- mon.write("ENTER COORDINATES INTO COMPUTER")
- term.clear()
- term.setCursorPos(1,1)
- write("Enter X: ")
- setX = read()
- term.clear()
- term.setCursorPos(1,1)
- write("Enter Y: ")
- setY = read()
- term.clear()
- term.setCursorPos(1,1)
- write("Enter Z: ")
- setZ = read()
- term.clear()
- term.setCursorPos(1,1)
- print("Done!")
- os.sleep(1)
- term.clear()
- update = true
- display()
- elseif event == "monitor_touch" and param2 > monX/5*2+1 and param2 < monX/5*3 and param3 > monY/2 then
- mon.setBackgroundColor(colors.black)
- mon.clear()
- mon.setTextColor(colors.yellow)
- mon.setCursorPos(monX/2 -8, 1)
- mon.write("CONFIRM LAUNCH AT")
- leng = string.len("X: "..tostring(x).." Y: "..tostring(y).." Z: "..tostring(z))
- mon.setCursorPos((monX/2)-leng/2+1, 3)
- mon.write("X: "..x.." Y: "..y.." Z: "..z)
- mon.setTextColor(colors.black)
- mon.setBackgroundColor(colors.red)
- for k = monY/2+1, monY do
- for i = 1, monX/5*2 do
- mon.setCursorPos(i, k)
- mon.write(" ")
- end
- end
- mon.setCursorPos(monX/5-3, monY/4*3+1)
- mon.write("Launch")
- mon.setBackgroundColor(colors.green)
- for k = monY/2+1, monY do
- for i = monX/5*3+1, monX do
- mon.setCursorPos(i,k)
- mon.write(" ")
- end
- end
- mon.setCursorPos(monX/5*4-7, monY/4*3+1)
- mon.write("Abort Launch")
- event, param1, param2, param3 = os.pullEvent("monitor_touch")
- if param2 > monX/5*3 and param3 > monY/2 then
- launch = false
- print(launch)
- elseif param2 < monX/5*2 and param3 > monY/2 then
- launch = true
- end
- display()
- elseif event == "monitor_touch" and param2 < monX/5*2 and param3 > monY/2 and portal == "n" then
- bookmarks()
- elseif event == "monitor_touch" and param2 < monX/5*2 and param3 > monY/2 and param3 < monY/4*3+1 and portal == "y" then
- bookmarks()
- elseif event == "monitor_touch" and param2 < (monX/5*2)/8*7 and param3 > monY/4*3 and portal == "y" then
- link()
- elseif event == "monitor_touch" and param2 < monX/5*2+1 and param3 > monY/4*3 then
- mon.clear()
- rednet.send(linkTurtle, "off")
- id, message = rednet.receive(10)
- if adj == "0prt" then
- if message == "true" then
- mon.setCursorPos(monX/2 - string.len("Portal disabled.")/2+1, monY/2)
- mon.write("Portal disabled!")
- sleep(2)
- display()
- else
- mon.setCursorPos(monX/2 - string.len("Portal is already disabled.")/2+1, monY/2)
- mon.write("Portal is already disabled.")
- sleep(1.5)
- display()
- end
- elseif id == tonumber(linkTurtle) and message == "true" then
- mon.setCursorPos(monX/2 - string.len("Portal disabled!")/2+1, monY/2)
- mon.write("Portal disabled!")
- table = {name = "Portal Inactive", x = 0, y = 0, z = 0}
- table = textutils.serialize(table)
- file = fs.open("0prt", "w")
- file.write(table)
- file.close()
- adjX = 0
- adjY = 0
- adjZ = 0
- adj = "0prt"
- file = fs.open("adj","w")
- file.write("0prt")
- file.close()
- update = true
- sleep(2)
- display()
- else
- mon.setCursorPos(monX/2 - string.len("Turtle Error. Portal still active!")/2+1, monY/2)
- mon.write("Turtle Error. Portal still active!")
- sleep(2)
- display()
- end
- elseif event == "monitor_touch" and param2 > monX/5*3+1 and param3 >monY/4*3 then
- sleep(1)
- rednet.send(missileTurtle, "getList")
- while id ~= missileTurtle do
- id, message = rednet.receive()
- end
- missiles = textutils.unserialize(message)
- mon.setTextColor(colors.white)
- mon.clear()
- mon.setBackgroundColor(colors.black)
- for i = 1, 12, 2 do
- for v = 1, monX do
- mon.setCursorPos(v, i)
- mon.write(" ")
- end
- end
- mon.setBackgroundColor(colors.blue)
- for i = 2, 12, 2 do
- for v = 1, monX do
- mon.setCursorPos(v, i)
- mon.write(" ")
- end
- end
- for i = 1, 12 do
- for k,v in pairs(missiles[i]) do
- if bit.band(i, 1) == 0 then
- mon.setBackgroundColor(colors.blue)
- else
- mon.setBackgroundColor(colors.black)
- end
- if k == "name" then
- mon.setCursorPos(1, i)
- mon.write(v..":")
- elseif k == "count" then
- mon.setCursorPos(monX/2, i)
- mon.write(tostring(v))
- end
- end
- end
- mon.setBackgroundColor(colors.lime)
- for i = 1, 13 do
- mon.setCursorPos(monX - 5, i)
- mon.write("Rename")
- end
- event, param1,param2,param3 = os.pullEvent("monitor_touch")
- if param2 > monX - 5 then
- mon.setBackgroundColor(colors.black)
- mon.clear()
- mon.setCursorPos(monX/2 - string.len("Follow Instructions on the computer below.")/2-1, monY/2)
- mon.write("Follow Instructions on the computer below.")
- term.clear()
- term.setCursorPos(1,1)
- print("Enter the type of missile in slot "..param3..". Leave blank if empty.")
- write("> ")
- mName = read()
- id = nil
- while id ~= missileTurtle do
- rednet.send(missileTurtle, "setName")
- id, message = rednet.receive()
- if id == missileTurtle then
- rednet.send(missileTurtle, mName)
- dud, dud2 = rednet.receive()
- rednet.send(missileTurtle, param3)
- print("sent")
- sleep(1)
- else
- print("Communication Error With Turtle!!!")
- sleep(1)
- end
- end
- term.clear()
- term.setCursorPos(1,1)
- else
- rednet.send(missileTurtle, tostring(param3))
- mon.clear()
- end
- display()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement