Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print()
- local function drawKeyPad()
- for i = 1 ,9 do
- write("|")
- term.setTextColor(colors.lightBlue)
- write(i)
- term.setTextColor(1)
- if i%3==0 then write("|\n") end
- end
- write("[Enter]")
- end
- local CorrectPassword = 1242
- local IncorrectString = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
- local function correctAnimation()
- shell.execute("clear")
- print()
- print()
- term.setTextColor(colors.lime)
- print("Correct")
- term.setTextColor(1)
- local event, button, x, y = os.pullEvent("mouse_click")
- shell.execute("clear")
- end
- local function IncorrectAnimation()
- for i=1,3 do
- shell.execute("clear")
- term.setTextColor(colors.red)
- write(IncorrectString)
- sleep(0.2)
- shell.execute("clear")
- term.setTextColor(colors.white)
- write(IncorrectString)
- sleep(0.2)
- shell.execute("clear")
- term.setTextColor(colors.red)
- write(IncorrectString)
- sleep(0.2)
- shell.execute("clear")
- end
- term.setTextColor(1)
- end
- local function findWhichNum(x,y)
- if y == 5 then
- return 10
- elseif x==2 or x==4 or x==6 then
- if y==2 then
- return x/2
- elseif y==3 then
- return x/2 + 3
- elseif y==4 then
- return x/2 + 6
- end
- end
- return 0
- end
- while true do
- shell.execute("clear")
- print("")
- drawKeyPad()
- local length = 0
- local enteredPassword = 0
- repeat
- local event, button, x, y = os.pullEvent("mouse_click")
- local num = findWhichNum(x,y)
- if num == 10 then
- length = 7
- elseif num ~= 0 then
- enteredPassword = enteredPassword*10 + num
- length = length + 1
- end
- shell.execute("clear")
- if enteredPassword == 69 then
- print(enteredPassword,"nice")
- elseif enteredPassword == 1337 then
- print(enteredPassword,"lit")
- else
- print(enteredPassword)
- end
- drawKeyPad()
- until length > 6
- if enteredPassword == CorrectPassword then
- redstone.setOutput("bottom",true)
- correctAnimation()
- else
- IncorrectAnimation()
- end
- redstone.setOutput("bottom",false)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement