Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-25-2007, 11:12 PM
DrakilorP2P DrakilorP2P is offline
Registered User
DrakilorP2P's Avatar
Join Date: Apr 2006
Posts: 755
DrakilorP2P is just really niceDrakilorP2P is just really nice
Keydown event? (Not onKeyPressed)

I'm trying to find a way to detect when a key is pushed down, and not when it's pressed (onKeyPressed). The effect would basically be the same as onKeyPressed, but without the auto-repeat most operating systems implements.

From searching the forums, I've found that onKeyDown and onKeyUp apparently can be used in GUI controls, but none of them works in a standard "weapon". (Declaring onKeyUp() and KeyUp())

My goal is to call a function when a key is tapped twice within a specified timespan. At first I did this with onKeyPressed and timevar2, but previously mentioned auto-repeat messed that up, calling the function repeatedly when the button was held down.

As an alternative, I thought about checking for the keys in onTimeout(), but the way I constructed it, it would limit the timespan to a minimum of 0.1. (Not allowing the player to double press faster than that)
Reply With Quote
  #2  
Old 03-25-2007, 11:41 PM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
OnKeyDown works with only like 10 buttons if I remember correctly, though maybe I'm wrong :/

keydown( key ) the specified key is pressed
(0..10:up,left,down,right,S,A,D,M,tab,Q,P)
__________________
Deep into the Darkness peering...
Reply With Quote
  #3  
Old 03-26-2007, 12:06 AM
DrakilorP2P DrakilorP2P is offline
Registered User
DrakilorP2P's Avatar
Join Date: Apr 2006
Posts: 755
DrakilorP2P is just really niceDrakilorP2P is just really nice
Quote:
Originally Posted by Angel_Light View Post
OnKeyDown works with only like 10 buttons if I remember correctly, though maybe I'm wrong :/

keydown( key ) the specified key is pressed
(0..10:up,left,down,right,S,A,D,M,tab,Q,P)
You don't happen to be familiar with a way to to use keydown() in the way specified? (A better way than limiting to a minimum of 0.1 seconds)
Reply With Quote
  #4  
Old 03-26-2007, 12:50 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
0.1 seconds is pretty damn fast... Keep it like you have it and you should be just fine.

(And it isn't really 0.1...it is actually >0.05 since they just have to have the key released by the next 0.05 timeframe...after that frame they can press it again even if it is at 0.06 seconds)
__________________
Do it with a DON!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:07 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.