![]() |
Holding a keydown...
When a keydown() is used in a timeout it can just be held and it will do the action for you. How do I eliminate this? Just in case I'm not clear since I'm half-delusional from sleep and am not even reading while I type, here's an example:
PHP Code:
|
You need to initiate the timeout first. The only setTimer you have is in the timeout itself, so nothing is telling it to actually start looping. Throw a setTimer in an onCreated.
|
I know this, I'm just saying the context of it. Obviously, the script is much more than an uninitiated timeout with a keydown() in it :p
|
Oh, sorry I just read the script.
Anyways the only way to break the repeating function is to keep a flag on the key being hit. You can use onKeyPressed() but that has a repeat function based on default keyboard(after a second or so it'll start repeating). PHP Code:
|
I tried this and it didn't work... Although, when I did I combined the two line like this:
PHP Code:
I also noticed every flag is set to true. Am I missing something there? |
No you have to do it exactly as my post says because of the way the nested code works. If you do it like (keydown(5) && this.keydown5 == false) then it won't revert the this.keydown5 back to false since it requires not pressing S AND it being false.
|
Now it doesn't work at all o_o
|
PHP Code:
|
damn I was just going to post when i saw chris did it >.<
|
Ah, thanks to all of you. I knew there was a different way aside from timeouts.
Dusty, I got yours to work, I just entered it wrong. Although I had to change a few things around to make it work. Chris, thank you for this method... Probably a bit more efficient and much cleaner than what I did. |
Quote:
|
I like the..
PHP Code:
|
All times are GMT +2. The time now is 11:34 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.