Created
November 29, 2017 07:31
-
-
Save KeithHanson/b0957b238648be5b1f7802075915eca3 to your computer and use it in GitHub Desktop.
A ComputerCraft Gist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
userInput = "" | |
correctPassword = "potato" | |
function resetScreen(backgroundColor, textColor) | |
term.setBackgroundColor(backgroundColor) | |
term.setTextColor(textColor) | |
term.clear() | |
term.setCursorPos(1,1) | |
end | |
function promptForPassword() | |
resetScreen(colors.blue, colors.white) | |
print("Please enter the password to gain entry:") | |
end | |
function successRoutine() | |
resetScreen(colors.green, colors.black) | |
textutils.slowWrite("Access Granted... ") | |
textutils.slowWrite("3.. ", 3) | |
textutils.slowWrite("2.. ", 3) | |
textutils.slowWrite("1.. ", 3) | |
resetScreen(colors.black, colors.white) | |
end | |
function failureRoutine() | |
resetScreen(colors.red, colors.white) | |
textutils.slowPrint("Access Denied... ", 3) | |
end | |
while userInput ~= correctPassword do | |
failureRoutine() | |
promptForPassword() | |
userInput = read("*l") | |
end | |
successRoutine() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment