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 Startup()
- if not(Modem) then
- print("No WirelessModem Found !")
- error()
- end
- Temp()
- end
- function DelTemp()
- fs.delete("OS/Temp/Temp.Tem")
- end
- function Temp()
- if fs.exists("OS/Temp/Temp.Tem") then
- File = fs.open("OS/Temp/Temp.Tem", "r")
- Data = UnPack(File.readAll())
- File.close()
- Computer.ComputerName = Data.ComputerName
- Computer.LogOn = Data.LogOn
- Computer.Status = Data.Status
- Computer.UserName = Data.UserName
- end
- end
- Screen.clear()
- Screen.setCursorPos(1, 1)
- Startup()
- local w, h = Screen.getSize()
- local NameLen = 17
- local nOption = 1
- local MaxOptions = 3
- function drawMenu()
- Screen.clear()
- Screen.setCursorPos(1, 1)
- Screen.write("Base 01")
- Screen.setCursorPos(w-(NameLen+3), 1)
- if nOption == 1 then
- Screen.write("Make Account")
- elseif nOption == 2 then
- Screen.write("Login")
- elseif nOption == 3 then
- Screen.write("Shutdown")
- else
- end
- end
- Screen.clear()
- function drawFrontend()
- 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("[ Make Account",NameLen-1),"]") or Functions.PadString(" Make Account",NameLen)))
- Functions.printCentered(math.floor(h/2) +1, ((nOption == 2) and string.format("%s%s",Functions.PadString("[ Login",NameLen-1),"]") or Functions.PadString(" Login",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)))
- end
- function onEnter()
- if nOption == 1 then
- shell.run("OS/.Make")
- Temp()
- Screen.clear()
- drawMenu()
- drawFrontend()
- elseif nOption == 2 then
- shell.run("OS/.Login")
- Temp()
- Screen.clear()
- drawMenu()
- drawFrontend()
- elseif nOption == 3 then
- DelTemp()
- System.shutdown()
- end
- end
- drawMenu()
- drawFrontend()
- while not(Computer.LogOn) do
- 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
- drawMenu()
- drawFrontend()
- end
- elseif p1 == keys.down or p1 == keys.numPad2 then
- if nOption < MaxOptions then
- nOption = nOption + 1
- drawMenu()
- drawFrontend()
- end
- elseif p1 == keys.enter or p1 == keys.numPadEnter then
- onEnter()
- end
- end
- end
- shell.run("OS/.Menu")
Advertisement
Add Comment
Please, Sign In to add comment