Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local System = os -- Used for System things like os.time() to System.time()
- local Screen = term -- Used for Screen thing on the turtle or computer like term.clear() to Screen.clear()
- local Per = peripheral -- Used shortcut for peripheral
- local Text = textutils -- Used shortcut for textilils
- local Pack = Text.serialize -- Makes a new command for packing ( shortcut used from local Text)
- local UnPack = Text.unserialize -- Makes a new command for unpacking ( shortcut used from local Text)
- local Disk = "/disk"
- if pocket then
- Disk = ""
- end
- local file = fs.exists(Disk.."/API/Logo.lua")
- local file0 = fs.exists(Disk.."/API/Functions.lua")
- local Monitor = {}
- Monitor[0] = Screen
- if not(file) then
- shell.run("pastebin get s3aBGUVr "..Disk.."/API/Logo.lua")
- Monitor[0].clear()
- Monitor[0].setCursorPos(1,1)
- end
- if not(file0) then
- shell.run("pastebin get sujHjqXC "..Disk.."/API/Functions.lua")
- Monitor[0].clear()
- Monitor[0].setCursorPos(1,1)
- end
- System.loadAPI(Disk.."/API/Logo.lua")
- System.loadAPI(Disk.."/API/Functions.lua")
- local w, h = Monitor[0].getSize()
- Monitor[0].clear()
- Logo.drawLogo(Monitor[0], "Head", math.floor(w/2)-6, math.floor(h/2)-4)
- local W_Modem = Functions.FindWirelessModem()
- sleep(1)
- Monitor = Functions.FindMonitor()
- local Status = true
- function Startup()
- sleep(1)
- Monitor[0].clear()
- Monitor[0].setCursorPos(1, 1)
- Logo.drawLogo(Monitor[0], "Sub", 1, 1)
- Functions.printCentered(Monitor[0], 6,"Welcome to Turtle Remote Control (TRC) installer.")
- Functions.printCentered(Monitor[0], 8,"Press a key to continue or Q to quit.")
- local Event, p1, p2, p3 = System.pullEvent("key")
- Monitor[0].clear()
- Monitor[0].setCursorPos(1, 1)
- if p1 == keys.q then
- error()
- end
- end
- Startup()
- local NameLen = 17
- local nOption = 1
- local MaxOptions
- if turtle or pocket then
- MaxOptions = 2
- else
- MaxOptions = 4
- end
- function drawMenu()
- Monitor[0].clear()
- Monitor[0].setCursorPos(1, 1)
- Monitor[0].write("Setup Menu")
- Monitor[0].setCursorPos(w-(NameLen+3), 1)
- if turtle then
- if nOption == 1 then
- Monitor[0].write("Setup TRC Turtle OS")
- elseif nOption == 2 then
- Monitor[0].write("Cancel")
- end
- elseif pocket then
- if nOption == 1 then
- Monitor[0].write("Setup TRC Computer OS")
- elseif nOption == 2 then
- Monitor[0].write("Cancel")
- end
- else
- if nOption == 1 then
- Monitor[0].write("Setup TRC Server OS")
- elseif nOption == 2 then
- Monitor[0].write("Setup TRC Computer OS")
- elseif nOption == 3 then
- Monitor[0].write("Setup GPS Computer")
- elseif nOption == 4 then
- Monitor[0].write("Cancel")
- end
- end
- end
- function drawFrontend()
- Functions.printCentered(Monitor[0], math.floor(h/2) -3, "")
- Functions.printCentered(Monitor[0], math.floor(h/2) -2, Functions.PadString(" Setup Menu",NameLen))
- Functions.printCentered(Monitor[0], math.floor(h/2) -1, "")
- if turtle then
- Functions.printCentered(Monitor[0], math.floor(h/2) +0, ((nOption == 1) and string.format("%s%s",Functions.PadString("[ Turtle OS",NameLen-1),"]") or Functions.PadString(" Turtle OS",NameLen)))
- Functions.printCentered(Monitor[0], math.floor(h/2) +1, ((nOption == 2) and string.format("%s%s",Functions.PadString("[ Cancel",NameLen-1),"]") or Functions.PadString(" Cancel",NameLen)))
- elseif pocket then
- Functions.printCentered(Monitor[0], math.floor(h/2) +0, ((nOption == 1) and string.format("%s%s",Functions.PadString("[ Computer OS",NameLen-1),"]") or Functions.PadString(" Computer OS",NameLen)))
- Functions.printCentered(Monitor[0], math.floor(h/2) +1, ((nOption == 2) and string.format("%s%s",Functions.PadString("[ Cancel",NameLen-1),"]") or Functions.PadString(" Cancel",NameLen)))
- else
- Functions.printCentered(Monitor[0], math.floor(h/2) +0, ((nOption == 1) and string.format("%s%s",Functions.PadString("[ Server OS",NameLen-1),"]") or Functions.PadString(" Server OS",NameLen)))
- Functions.printCentered(Monitor[0], math.floor(h/2) +1, ((nOption == 2) and string.format("%s%s",Functions.PadString("[ Computer OS",NameLen-1),"]") or Functions.PadString(" Computer OS",NameLen)))
- Functions.printCentered(Monitor[0], math.floor(h/2) +2, ((nOption == 3) and string.format("%s%s",Functions.PadString("[ GPS OS",NameLen-1),"]") or Functions.PadString(" GPS OS",NameLen)))
- Functions.printCentered(Monitor[0], math.floor(h/2) +3, ((nOption == 4) and string.format("%s%s",Functions.PadString("[ Cancel",NameLen-1),"]") or Functions.PadString(" Cancel",NameLen)))
- end
- end
- function onEnter()
- if turtle then
- if nOption == 1 then
- if not(W_Modem) then
- Screen.clear()
- Functions.printCentered(Monitor[0], 1, "No WirelessModem Found !")
- Functions.printCentered(Monitor[0], 2, "Turtle Needs A WirelessModem !")
- error()
- end
- file = fs.exists(Disk.."/Setup/SetupTurtle.lua")
- if not(file) then
- shell.run("pastebin get CMLmkdxx "..Disk.."/Setup/SetupTurtle.lua")
- end
- shell.run(Disk.."/Setup/SetupTurtle.lua")
- Monitor[0].clear()
- Monitor[0].setCursorPos(1,1)
- print("Done")
- Status = false
- elseif nOption == 2 then
- Status = false
- end
- elseif pocket then
- if nOption == 1 then
- if not(W_Modem) then
- Screen.clear()
- Functions.printCentered(Monitor[0], 1, "No WirelessModem Found !")
- Functions.printCentered(Monitor[0], 2, "Pocket Computer Needs A WirelessModem !")
- error()
- end
- file = fs.exists(Disk.."/Setup/SetupComputer.lua")
- if not(file) then
- shell.run("pastebin get jGUi9Jui "..Disk.."/Setup/SetupComputer.lua")
- end
- shell.run(Disk.."/Setup/SetupComputer.lua")
- Monitor[0].clear()
- Monitor[0].setCursorPos(1,1)
- print("Done")
- Status = false
- elseif nOption == 2 then
- Status = false
- end
- else
- if nOption ~= 4 then
- if not(W_Modem) then
- Screen.clear()
- Functions.printCentered(Monitor[0], 1, "No WirelessModem Found !")
- Functions.printCentered(Monitor[0], 2, "The Computer Needs A WirelessModem !")
- error()
- end
- end
- if nOption == 1 then
- if #Monitor < 0 then
- Functions.printCentered(Monitor[0], 1, "No Monitor Found !")
- Functions.printCentered(Monitor[0], 2, "The Server Computer Needs A Monitor !")
- error()
- end
- file = fs.exists(Disk.."/Setup/SetupServer.lua")
- if not(file) then
- shell.run("pastebin get DW0yxZhw "..Disk.."/Setup/SetupServer.lua")
- end
- shell.run(Disk.."/Setup/SetupServer.lua")
- Monitor[0].clear()
- Monitor[0].setCursorPos(1,1)
- print("Done")
- Status = false
- elseif nOption == 2 then
- file = fs.exists(Disk.."/Setup/SetupComputer.lua")
- if not(file) then
- shell.run("pastebin get jGUi9Jui "..Disk.."/Setup/SetupComputer.lua")
- end
- shell.run(Disk.."/Setup/SetupComputer.lua")
- Monitor[0].clear()
- Monitor[0].setCursorPos(1,1)
- print("Done")
- Status = false
- elseif nOption == 3 then
- file = fs.exists("/StartUp.lua")
- if file then
- fs.delete("/StartUp.lua")
- end
- file = fs.exists("/GPS_IMAGE.nfp")
- if file then
- fs.delete("/GPS_IMAGE.nfp")
- end
- shell.run("pastebin get VpR0dk64 /StartUp.lua")
- shell.run("pastebin get fvvt8ZFe /GPS_IMAGE.nfp")
- Monitor[0].clear()
- Monitor[0].setCursorPos(1,1)
- print("Done")
- Status = false
- elseif nOption == 4 then
- Status = false
- end
- end
- end
- while Status do
- drawMenu()
- drawFrontend()
- local Event, p1, p2, p3, p4, p5 = System.pullEvent()
- if Event == "key" then
- if p1 == keys.up or p1 == keys.numPad8 then
- if nOption > 1 then
- nOption = nOption - 1
- end
- elseif p1 == keys.down or p1 == keys.numPad2 then
- if nOption < MaxOptions then
- nOption = nOption + 1
- end
- elseif p1 == keys.enter or p1 == keys.numPadEnter then
- onEnter()
- end
- end
- end
- print("Eject disk and reboot!")
Add Comment
Please, Sign In to add comment