Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Modem = {}
- local WirelessModemFound = false
- local Cor
- function SaveCor()
- local file = fs.open("/.Cor.Cor", "w")
- file.write(textutils.serialize(Cor))
- file.close()
- end
- if fs.exists("/.Cor.Cor") then
- Cor = {}
- local file = fs.open("/.Cor.Cor", "r")
- Cor = textutils.unserialize(file.readAll())
- file.close()
- end
- if term.isColor then
- term.clear()
- term.setCursorPos(1,1)
- print("Color Mode !!! ")
- local GPS_IMAGE = paintutils.loadImage('GPS_IMAGE.nfp')
- paintutils.drawImage(GPS_IMAGE, 1, 1) -- Change 1 and 1 to the co-ords of where you want the top corner of the image to be.
- local Pers = peripheral.getNames()
- for i,name in pairs(Pers) do
- for j,method in pairs(peripheral.getMethods(name)) do
- if (method == 'isWireless') then
- Modem = peripheral.wrap(name)
- if (Modem.isWireless()) then
- WirelessModemFound = true
- break
- else
- Modem = {}
- end
- end
- end
- if (WirelessModemFound) then
- break
- end
- end
- if not(WirelessModemFound) then
- term.clear()
- term.setCursorPos(1,1)
- term.setBackgroundColor(colors.red)
- term.setTextColor(colors.black)
- print("No Wireless Modem Found !!! ")
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- error()
- else
- if not(Cor) then
- term.clear()
- paintutils.drawImage(GPS_IMAGE, 1, 1)
- term.setCursorPos(1,1)
- print("Give in cordinates? Y/N")
- local event, key, isheld = os.pullEvent("key")
- if key == keys.y then
- term.clear()
- paintutils.drawImage(GPS_IMAGE, 1, 1)
- term.setCursorPos(1,1)
- Cor = {}
- write("X corditnate: ")
- Cor.x = tonumber(read())
- write("Y corditnate: ")
- Cor.y = tonumber(read())
- write("Z corditnate: ")
- Cor.z = tonumber(read())
- SaveCor()
- term.clear()
- paintutils.drawImage(GPS_IMAGE, 1, 1)
- term.setCursorPos(1,1)
- shell.run("gps", "host", Cor.x, Cor.y, Cor.z)
- else
- Cor = {}
- term.clear()
- paintutils.drawImage(GPS_IMAGE, 1, 1)
- term.setCursorPos(1,1)
- shell.run("gps", "host", Cor.x, Cor.y, Cor.z)
- end
- else
- term.clear()
- paintutils.drawImage(GPS_IMAGE, 1, 1)
- term.setCursorPos(1,1)
- shell.run("gps", "host", Cor.x, Cor.y, Cor.z)
- end
- end
- else
- term.clear()
- term.setCursorPos(1,1)
- print("Colorless Mode !!! ")
- local Pers = peripheral.getNames()
- for i,name in pairs(Pers) do
- for j,method in pairs(peripheral.getMethods(name)) do
- if (method == 'isWireless') then
- Modem = peripheral.wrap(name)
- if (Modem.isWireless()) then
- WirelessModemFound = true
- break
- else
- Modem = {}
- end
- end
- end
- if (WirelessModemFound) then
- break
- end
- end
- if not(WirelessModemFound) then
- term.clear()
- term.setCursorPos(1,1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- print("No Wireless Modem Found !!! ")
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- error()
- else
- if not(Cor) then
- term.clear()
- term.setCursorPos(1,1)
- print("Give in cordinates? Y/N")
- local event, key, isheld = os.pullEvent("key")
- if key == keys.y then
- Cor = {}
- write("X corditnate: ")
- Cor.x = tonumber(read())
- write("Y corditnate: ")
- Cor.y = tonumber(read())
- write("Z corditnate: ")
- Cor.z = tonumber(read())
- SaveCor()
- term.clear()
- term.setCursorPos(1,1)
- shell.run("gps", "host", Cor.x, Cor.y, Cor.z)
- else
- Cor = {}
- term.clear()
- term.setCursorPos(1,1)
- shell.run("gps", "host", Cor.x, Cor.y, Cor.z)
- end
- else
- term.clear()
- term.setCursorPos(1,1)
- shell.run("gps", "host", Cor.x, Cor.y, Cor.z)
- end
- end
- end
Add Comment
Please, Sign In to add comment