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 file = fs.exists("/Progs/.Data/.Progs.txt")
- if not(file) then
- shell.run("pastebin get SZHXV7Kz /Progs/.Data/.Progs.txt")
- end
- file = fs.open("/Progs/.Data/.Progs.txt", "r")
- local ProgS = UnPack(file.readAll())
- file.close()
- 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 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 = #ProgS + 1
- function drawScreen()
- if pocket then
- Screen.clear()
- Screen.setCursorPos(1, 1)
- Screen.write("User : "..Computer.UserName)
- Screen.setCursorPos(1, 2)
- Screen.write(Computer.ComputerName)
- Screen.setCursorPos(1, 3)
- else
- Screen.clear()
- 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 == MaxOptions then
- Screen.write("Back")
- else
- Screen.write(ProgS[nOption].extra)
- end
- Functions.printCentered(math.floor(h/2) -3, "")
- Functions.printCentered(math.floor(h/2) -2, Functions.PadString(" Prog's Menu",NameLen))
- Functions.printCentered(math.floor(h/2) -1, "")
- local a
- for i = 1, #ProgS do
- Functions.printCentered(math.floor(h/2) +(i - 1), ((nOption == i) and string.format("%s%s",Functions.PadString("[ "..ProgS[i].name,NameLen-1),"]") or Functions.PadString(" "..ProgS[i].name,NameLen)))
- a = i
- end
- Functions.printCentered(math.floor(h/2) +a, ((nOption == MaxOptions) and string.format("%s%s",Functions.PadString("[ Back",NameLen-1),"]") or Functions.PadString(" Back",NameLen)))
- end
- function onEnter()
- if nOption == MaxOptions then
- Computer.Status = false
- else
- shell.run(ProgS[nOption].prog)
- Screen.clear()
- 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
Advertisement
Add Comment
Please, Sign In to add comment