|
-
I would simply add the pressed keys to a string and compare it with your password. if a wrong key is pressed the string is cleared and you start from the beginning.
function checkkey(letter){
keystrokes+=letter
if (magicword.substr(0,keystrokes.length)!=keystrokes ){
keystrokes=""
} else {
if (magicword==keystrokes)
opensesame()
}
}
This function assumes that "letter" already contains the keycode converted to a letter.
Cheers
Mario
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|