Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- serverID = 44
- function clear()
- term.setCursorPos(1,1)
- term.clear()
- end
- function xor(a, b)
- if a == b then return false else return true end
- end
- for _,v in pairs(rs.getSides()) do rednet.open(v) end
- lsusr = true
- lsuser = ""
- lspass = ""
- lsres = ""
- lserr = ""
- lsiskey = false
- lskey = ""
- chars = { [14] = "backspace" ,[16] = "q",[17] = "w",[18] = "e",[19] = "r",[20] = "t",[21] = "y",[22] = "u",[23] = "i",[24] = "o",[25] = "p" ,[30] = "a",[31] = "s",[32] = "d",[33] = "f",[34] = "g",[35] = "h",[36] = "j",[37] = "k",[38] = "l",[44] = "z",[45] = "x",[46] = "c",[47] = "v",[48] = "b",[49] = "n",[50] = "m" }
- while true do
- lsiskey = false
- lskey = ""
- clear()
- term.setCursorPos(1,1)
- print(" __ __ __ __ ____ _____ __ __ ")
- print(" \\ \\ / / \\ \\ / / / __ \\ / ____| /_ |/_ |")
- print(" \\ V / ___ \\ V / | | | | (___ | | | |")
- print(" > < / _ \\ > < | | | |\\___ \\ | | | |")
- print(" / . \\ (_) / . \\ | |__| |____) | | |_| |")
- print(" /_/ \\_\\___/_/ \\_\\ \\____/|_____/ |_(_)_|")
- term.setCursorPos(5,9)
- if not rednet.send(1, "") then lsres = "guest" print("Signing in as guest because no" ); term.setCursorPos(5,10); print( "modem was found");sleep(3); break; end
- if lsusr then
- print("Username: " .. lsuser .. "\|" )
- term.setCursorPos(5,11)
- print("Password: " .. lspass )
- else
- print("Username: " .. lsuser )
- term.setCursorPos(5,11)
- print("Password: " .. lspass .. "\|" )
- end
- term.setCursorPos(3,13)
- print("Leave empty and press Enter to")
- term.setCursorPos(3, 14)
- print("to sign in as a guest.")
- local lsevent, lsparam = os.pullEvent("key")
- for k, v in pairs(chars) do if k == lsparam then lsiskey = true ; lskey = v end end
- if lsiskey == true then
- if lsparam == 14 then
- if lsusr then
- lsuser = string.sub(lsuser, 1 , -2)
- else
- lspass = string.sub(lspass, 1 , -2)
- end
- else
- if lsusr then
- lsuser = lsuser .. lskey
- else
- lspass = lspass .. lskey
- end
- end
- elseif lsparam == 28 then
- if lsuser == "" and lspass == "" then
- lsres = "guest"
- break
- end
- if xor( lsuser == "", lspass == "") then
- if lsusr and lspass == "" then
- lsusr = not lsusr
- else
- lserr = "Invalid User/Password combination"
- end
- else
- rednet.send(serverID, lsuser .. ";" .. lspass )
- lsrevent, lsrid, lsrmsg, _ = os.pullEvent("rednet_message")
- if lsrid == serverID and lsrmsg == "OK" then
- lsres = "OK"
- break
- else
- lserr = "Invalid User/Password combination"
- end
- end
- elseif lsparam == 200 or lsparam == 208 then
- lsusr = not lsusr
- end
- end
- ttable = {}
- ttable.copy = ""
- ttable.copy = function(t1)
- local t2 = {}
- for k,v in pairs(t1) do
- if type(v) == "table" then
- t2[k] = ttable.copy(v)
- else
- t2[k] = v
- end
- end
- return t2
- end
- startupprog = "none"
- notifytext = "XoXOS 1.1"
- function saveconfig()
- conff = fs.open("XoXOSC", "w")
- conff.writeLine(startupprog)
- conff.close()
- notifytext = "Saved."
- end
- menuIndex = 1
- menu = {}
- menu1 = {}
- menu2 = {}
- menu3 = {}
- menu4 = {}
- menu5 = {}
- menu6 = {}
- menu1.esc = function() end
- menu1[1] = { txt = "Programs" , exec = function() menu = ttable.copy( menu2 ) ; menuIndex = 1 end }
- menu1[2] = { txt = "Games" , exec = function() menu = ttable.copy( menu3 ) ; menuIndex = 1 end}
- menu1[3] = { txt = "Options", exec = function() menu = ttable.copy( menu4 ) ; menuIndex = 1 end}
- if lsres == "OK" then
- menu1[4] = { txt = "Dev", exec = function() menu = ttable.copy( menu6 ) ; menuIndex = 1 end}
- end
- menu2.esc = function() menu = ttable.copy( menu1 ) ; menuIndex = 1 end
- menu2[1] = { prog = "door", txt = "Door", exec = function() shell.run("door") end}
- menu2[2] = { prog = "calc", txt = "Calculator", exec = function() shell.run("calc") end}
- if fs.exists("XoXOSProgs") then
- progsf = fs.open("XoXOSProgs" , "r" )
- progs = {}
- for i = 1, progsf.readLine() do
- progs[#progs + 1] = progsf.readLine()
- progs[#progs + 1] = progsf.readLine()
- end
- progsf.close()
- for i = 1, #progs, 2 do
- menu2[#menu2 + 1] = { prog = progs[i], txt = progs[i + 1], exec = function() shell.run(progs[i]) end}
- end
- end
- menu3.esc = function() menu = ttable.copy( menu1 ) ; menuIndex = 1 end
- menu3[1] = { txt = "Text Minecraft", exec = function() shell.run("adventure") end}
- menu3[2] = { txt = "Snake", exec = function() shell.run("worm") end}
- menu4.esc = function() menu = ttable.copy( menu1 ) ; menuIndex = 1 end
- menu4[1] = { txt = "Startup Program", exec = function() menu = ttable.copy( menu5 ) ; menuIndex = 1 end}
- menu4[#menu4 + 1] = { txt = "Save" , exec = saveconfig }
- menu5.esc = function() menu = ttable.copy( menu4 ) ; menuIndex = 1 end
- menu5[1] = { prog = "door", txt = "Door", exec = function() shell.run("door") end}
- menu5[2] = { prog = "calc", txt = "Calculator", exec = function() shell.run("calc") end}
- table.insert(menu5, 1, { txt = "None", prog = "none" })
- if fs.exists("XoXOSProgs") then
- for i = 1, #progs, 2 do
- menu5[#menu5 + 1] = { prog = progs[i], txt = progs[i + 1], exec = function() shell.run(progs[i]) end}
- end
- end
- for k, v in ipairs(menu5) do
- v.exec = function() startupprog = menu5[menuIndex].prog end
- end
- menu6.esc = function() menu = ttable.copy( menu1 ) ; menuIndex = 1 end
- menu6[1] = { txt = "Lua Console", exec = function() shell.run("lua") end}
- menu6[2] = { txt = "File Browser", exec = function() shell.run("XoXFS") end}
- menu6[3] = { txt = "Edit File", exec = function() shell.run("XoXEdit") end}
- menu6[4] = { txt = "Execute File", exec = function() shell.run("XoXRun") end}
- menu6[5] = { txt = "Leave XoXOS", exec = function() return end}
- if fs.exists("XoXOSC") then
- conff = fs.open("XoXOSC" , "r" )
- startupprog = conff.readLine()
- conff.close()
- end
- if startupprog ~= "none" then
- shell.run(startupprog)
- end
- menu = ttable.copy( menu1 )
- term.clear()
- term.setCursorPos(1,1)
- while true do
- term.clear()
- term.setCursorPos(1,1)
- for k,v in ipairs(menu) do
- print(" ")
- if menuIndex == k then
- print( ">> " .. v.txt .. " <<")
- else
- print( " " .. v.txt)
- end
- end
- term.setCursorPos(1,16)
- if lsres == "guest" then
- print("Signed in as Guest")
- elseif lsres == "OK" then
- print("Signed in as " .. lsuser )
- end
- term.setCursorPos(1,17)
- print(notifytext)
- conf = fs.open("XoXOSDev", "w")
- conf.writeLine("Nope.")
- conf.close()
- local event, param1 = os.pullEvent("key")
- notifytext = "XoXOS 1.1"
- if param1 == 200 then
- menuIndex = menuIndex - 1
- if menuIndex < 1 then menuIndex = #menu end
- elseif param1 == 208 then
- menuIndex = menuIndex + 1
- if menuIndex > #menu then menuIndex = 1 end
- elseif param1 == 28 or param1 == 205 then
- term.clear()
- term.setCursorPos(1,1)
- menu[menuIndex].exec()
- elseif param1 == 14 or param1 == 203 then
- menu.esc()
- elseif param1 == 60 then
- term.clear()
- term.setCursorPos(1,1)
- print("Enter Developer Password:")
- local pwwd = read("*")
- if pwwd == "luadev" then
- conf = fs.open("XoXOSDev", "w")
- conf.writeLine("Let's go")
- conf.close()
- return
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment