Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/lua
- local component = require("component")
- local computer = require("computer")
- local text = require("text")
- local unicode = require("unicode")
- local pin = "1234"
- if not component.isAvailable("gpu") then
- return
- end
- local lines = {_OSVERSION .. " (" .. math.floor(computer.totalMemory() / 1024) .. "k RAM)"}
- local maxWidth = unicode.len(lines[1])
- local f = io.open("/usr/misc/greetings2.txt")
- if f then
- local greetings = {}
- pcall(function()
- for line in f:lines() do table.insert(greetings, line) end
- end)
- f:close()
- local greeting = greetings[math.random(1, #greetings)]
- if greeting then
- local width = math.max(10, component.gpu.getResolution())
- for line in text.wrappedLines(greeting, width - 4, width - 4) do
- table.insert(lines, line)
- maxWidth = math.max(maxWidth, unicode.len(line))
- end
- end
- end
- ::pin_enter::
- print("Please enter the correct PIN to unlock door.")
- local inputvar = term.write(tostring(env._PROMPT or "pin "))
- if inputvar == pin then
- goto correct
- end
- else
- print("Incorrect.")
- goto pin_enter
- end
- ::correct::
- print("Correct.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement