Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Version = "1.0.0"
- local ComputerVersion = "1.0.0"
- 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 OldpullEvent = System.pullEvent
- System.pullEvent = System.pullEventRaw
- local file = fs.exists("/API/Functions.lua")
- if not(file) then
- shell.run("pastebin get sujHjqXC /API/Functions.lua")
- end
- System.loadAPI("/API/Functions.lua")
- local Modem = Per.wrap(Functions.FindWirelessModem())
- local Send = Modem.transmit
- Modem.closeAll()
- local Monitor = Per.wrap(Functions.FindMonitor())
- local Computer = { ComputerName = "Test_Computer",
- Status = true,
- LogOn = false,
- }
- System.setComputerLabel(Computer.ComputerName)
- function DelTemp()
- Functions.DelFile("OS/Temp")
- end
- function Temp()
- local Data = Functions.LoadFile("OS/Temp/Temp.Tem")
- if Data then
- Computer.ComputerName = Data.ComputerName
- Computer.LogOn = Data.LogOn
- Computer.Status = Data.Status
- Computer.UserName = Data.UserName
- end
- end
- function Startup()
- if not(Modem) then
- print("No WirelessModem Found !")
- error()
- end
- Temp()
- end
- Screen.clear()
- Screen.setCursorPos(1, 1)
- Startup()
- local w, h = Screen.getSize()
- local NameLen = 17
- local nOption = 1
- local MaxOptions = 4
- function drawScreen()
- Screen.clear()
- if pocket then
- Screen.setCursorPos(1, 1)
- Screen.write("User : "..Computer.UserName)
- Screen.setCursorPos(1, 2)
- Screen.write(Computer.ComputerName)
- Screen.setCursorPos(1, 3)
- else
- Screen.setCursorPos(1, 1)
- Screen.write("User : "..Computer.UserName)
- Screen.setCursorPos(1, 2)
- Screen.write(Computer.ComputerName)
- Screen.setCursorPos(w-(NameLen+3), 1)
- end
- if nOption == 1 then
- Screen.write("Prog's")
- elseif nOption == 2 then
- Screen.write("Shell Command")
- elseif nOption == 3 then
- Screen.write("Shutdown")
- elseif nOption == 4 then
- Screen.write("Uninstall OS")
- else
- end
- Functions.printCentered(math.floor(h/2) -3, "")
- Functions.printCentered(math.floor(h/2) -2, Functions.PadString(" Head Menu",NameLen))
- Functions.printCentered(math.floor(h/2) -1, "")
- Functions.printCentered(math.floor(h/2) +0, ((nOption == 1) and string.format("%s%s",Functions.PadString("[ Prog's",NameLen-1),"]") or Functions.PadString(" Prog's",NameLen)))
- Functions.printCentered(math.floor(h/2) +1, ((nOption == 2) and string.format("%s%s",Functions.PadString("[ Shell Command",NameLen-1),"]") or Functions.PadString(" Shell Command",NameLen)))
- Functions.printCentered(math.floor(h/2) +2, ((nOption == 3) and string.format("%s%s",Functions.PadString("[ Shutdown",NameLen-1),"]") or Functions.PadString(" Shutdown",NameLen)))
- Functions.printCentered(math.floor(h/2) +3, ((nOption == 4) and string.format("%s%s",Functions.PadString("[ Uninstall OS",NameLen-1),"]") or Functions.PadString(" Uninstall OS",NameLen)))
- end
- function onEnter()
- if nOption == 1 then
- shell.run("OS/.Progs")
- Screen.clear()
- elseif nOption == 2 then
- System.pullEvent = OldpullEvent
- Computer.Status = false
- elseif nOption == 3 then
- DelTemp()
- System.shutdown()
- elseif nOption == 4 then
- shell.run("OS/Uninstall")
- error()
- end
- end
- repeat
- drawScreen()
- 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
- until Computer.Status == false
- Screen.clear()
- Screen.setCursorPos(1, 1)
- print("Type 'Back' to go back to the menu.")
Add Comment
Please, Sign In to add comment