Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Unique password concept
- Idea and created by VintageRIce
- Started: July 26th 2014
- ]]
- --Setting up the variables
- local xPass = {"1", "2", "3", "4"}
- local yPass = {"1", "2", "3", "4"}
- local passChars = {"A", "B", "C", "D"}
- local xLoc = {0, 0, 0, 0}
- local yLoc = {0, 0, 0, 0}
- local xPos = 1
- local yPos = 1
- local doCount = 1
- local passCount = 0
- --Check if the password is correct
- function checkPass()
- for i = 1, 4 do
- if xLoc[i] == xPass[i] then
- passCount = passCount + 1
- end
- if yLoc[i] == yPass[i] then
- passCount = passCount + 1
- end
- end
- term.clear()
- term.setCursorPos(1, 1)
- print(passCount)
- end
- --Prints the GUI on each key press
- function printScreen(value)
- term.clear()
- for i = 1, 51 do
- paintutils.drawPixel(i, 16, colours.red)
- end
- term.setCursorPos(1, 17)
- print("Editing: "..passChars[doCount])
- print("Current Position: "..xPos..", "..yPos)
- term.setCursorPos(xPos, yPos)
- print("X")
- end
- --Monitors the key input
- function monitorInput()
- while true do
- event, char = os.pullEvent("char")
- if char == "w" or "a" or "s" or "d" or "f" then
- if char == "w" then
- yPos = yPos - 1
- end
- if char == "a" then
- xPos = xPos - 1
- end
- if char == "s" then
- yPos = yPos + 1
- end
- if char == "d" then
- xPos = xPos + 1
- end
- if char == "f" then
- for i = 1, 4 do
- if doCount == i then
- xLoc[i] = xPos
- yLoc[i] = yPos
- end
- end
- doCount = doCount + 1
- end
- printScreen(doCount)
- end
- end
- end
- printScreen()
- monitorInput()
Advertisement
Add Comment
Please, Sign In to add comment