Skip to content

Instantly share code, notes, and snippets.

@KeithHanson
Created November 29, 2017 07:31
Show Gist options
  • Save KeithHanson/b0957b238648be5b1f7802075915eca3 to your computer and use it in GitHub Desktop.
Save KeithHanson/b0957b238648be5b1f7802075915eca3 to your computer and use it in GitHub Desktop.
A ComputerCraft Gist
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