Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local t = term
- local c = term.clear
- local s = term.setCursorPos
- local tc = term.setTextColor
- local bc = term.setBackgroundColor
- local w = term.write
- local CID = nil
- local PSW = nil
- local USR = nil
- local CHU = 0
- local Password = {}
- local string = ""
- function makePassword()
- CHU = CHU + 1
- c()
- s(1,1)
- tc(colors.green)
- w(CHU..". ")
- tc(colors.blue)
- s(1,2)
- w(": "..string)
- tc(colors.red)
- local input = read()
- if input == "done" or input == "Done" or input == "DONE" or input == "" or input == " " or input == " " or input == " " then
- CHU = CHU - 1
- return true
- else
- string = string..input
- Password[CHU] = input
- makePassword()
- end
- end
- function getInput(x, y, q)
- tc(colors.green)
- s(x,y)
- w(q)
- tc(colors.red)
- s(x,y+1)
- w("> ")
- local input = read()
- tc(colors.white)
- return input
- end
- function generated() -- Just proof :)
- local point = 1
- c()
- s(1,point)
- tc(colors.green)
- w("Generated a floppy disk with:")
- tc(colors.yellow)
- s(1,point+1)
- w("ChunkID: ")
- tc(colors.red)
- w(CID)
- tc(colors.yellow)
- s(1,point+2)
- w("ChunkID: ")
- tc(colors.red)
- w(CID)
- s(1,point+3)
- tc(colors.yellow)
- w("Username: ")
- tc(colors.red)
- w(USR)
- s(1,point+4)
- tc(colors.yellow)
- w("Password: ")
- tc(colors.red)
- w(PSW)
- for i = 1, CHU do
- s(1, point+5+i)
- w(i..". "..Password[i])
- end
- s(1,point+CHU+6)
- local newTable = fs.list("/disk/")
- if newTable[1] == nil then
- -- chunkID
- newFile = fs.open("/disk/chunkID", "w")
- newFile.writeLine(tostring(CID))
- newFile.close()
- -- chunks
- newFile = fs.open("/disk/chunks", "w")
- newFile.writeLine(tostring(CHU))
- newFile.close()
- -- username
- newFile = fs.open("/disk/username", "w")
- newFile.writeLine(tostring(USR))
- newFile.close()
- -- password
- for i = 1, CHU do
- newFile = fs.open("/disk/"..CID.."_"..i, "w")
- newFile.writeLine(tostring(Password[i]))
- newFile.close()
- end
- else
- c()
- s(1,1)
- w("Falied, there is already files on the Floppy Disk")
- end
- end
- function boot()
- c()
- CID = getInput(1, 1, "What should the identifier look like?")
- USR = getInput(1, 3, "What is your username?")
- makePassword()
- PSW = string
- --PSW = getInput(1, 5, "Can you type you password ono for one?")
- generated()
- end
- boot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement