Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- passAttempt = ""
- pass = "1111"
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- function getClicked()
- if y == 7 then
- if x == 8 then
- clickedNum = 1
- elseif x == 10 then
- clickedNum = 2
- elseif x == 12 then
- clickedNum = 3
- end
- elseif y == 9 then
- if x == 8 then
- clickedNum = 4
- elseif x == 10 then
- clickedNum = 5
- elseif x == 12 then
- clickedNum = 6
- end
- elseif y == 11 then
- if x == 8 then
- clickedNum = 7
- elseif x == 10 then
- clickedNum = 8
- elseif x == 12 then
- clickedNum = 9
- end
- elseif y == 13 then
- if x == 10 then
- clickedNum = 0
- end
- end
- end
- function PINsetup()
- clear()
- x = 3
- print("SVETprog PIN program V0.1 - LUA, CC")
- term.setCursorPos(12,x)
- print("Please enter your PIN.")
- term.setCursorPos(12,x+2)
- print("----------------------")
- x=8
- y=7
- term.setCursorPos(x,y)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- print(1)
- term.setCursorPos(x+2,y)
- print(2)
- term.setCursorPos(x+4,y)
- print(3)
- term.setCursorPos(x, y+2)
- print(4)
- term.setCursorPos(x+2,y+2)
- print(5)
- term.setCursorPos(x+4,y+2)
- print(6)
- term.setCursorPos(x, y+4)
- print(7)
- term.setCursorPos(x+2, y+4)
- print(8)
- term.setCursorPos(x+4,y+4)
- print(9)
- term.setCursorPos(x+2, y+6)
- print(0)
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.black)
- term.setCursorPos(30,9)
- print("> ")
- term.setCursorPos(34,9)
- end
- clickCounter = 0
- PINsetup()
- while true do
- event, x, y = os.pullEvent()
- if event == "click" then
- getClicked()
- if clickedNum ~= nil then
- write("*")
- passAttempt = passAttempt .. tostring(clickedNum)
- clickedNum = nil
- clickCounter = clickCounter + 1
- else
- term.setCursorPos(34,10)
- print("Invalid Click.")
- sleep(1)
- PINsetup()
- term.setCursorPos(34,9)
- asNum = string.len(passAttempt)
- for i = 1,asNum do
- write("*")
- end
- end
- if clickCounter >= 4 then
- PINsetup()
- print("Please Wait")
- break
- end
- end
- end
- sleep(5)
- clear()
- if passAttempt == pass then
- print("Password Accepted!")
- else
- print("Password denied!")
- end
- term.setBackgroundColor(colors.black)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement