Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Kinoko on Sun 10/07/2005 08:08:50

Title: Checking key pressed in repeatedly_execute
Post by: Kinoko on Sun 10/07/2005 08:08:50
How can I check if any key is currently pressed in repeatedly_execute? I tried keycode which doesn't work outside of on_key_press and I even tried if (on_key_press==0) but yeah, that didn't work (it was a long shot).
Title: Re: Checking key pressed in repeatedly_execute
Post by: Rui 'Trovatore' Pires on Sun 10/07/2005 08:11:05
IsKeyPressed(int keycode); ;)
Title: Re: Checking key pressed in repeatedly_execute
Post by: Kinoko on Sun 10/07/2005 08:13:14
But ANY key, not a specific key.
Title: Re: Checking key pressed in repeatedly_execute
Post by: Rui 'Trovatore' Pires on Sun 10/07/2005 08:17:59
Ah. Whoops.

Try this. Start with a check to see if the processing can begin, then use a "while" loop to "scroll" through the keycodes you want to test. Can't explain better, am in hurry, but someone else can - but I think you get it.
Title: Re: Checking key pressed in repeatedly_execute
Post by: Pumaman on Sun 10/07/2005 11:52:06
There's no specific way to do this, as it's not a common request. You'd have to do as Rui says and loop through all the keycodes you're interested in, and test them with IsKeyPressed.
Title: Re: Checking key pressed in repeatedly_execute
Post by: Kinoko on Sun 10/07/2005 12:12:36
Ah well, thanks ^_^
Title: Re: Checking key pressed in repeatedly_execute
Post by: Rui 'Trovatore' Pires on Sun 10/07/2005 16:47:09
BTW, are you sure it's nothing you can just place BEFORE any keycode checks in on_key_press (and BEFORE the IsGamePaused check) with some more appropriate checks? It might be easier and just as effective
Title: Re: Checking key pressed in repeatedly_execute
Post by: Kinoko on Sun 10/07/2005 17:16:23
Actually, I did go and find another way to check :P
Title: Re: Checking key pressed in repeatedly_execute
Post by: Rui 'Trovatore' Pires on Sun 10/07/2005 17:24:38
Could you share? :) I'm curious and interested. Unless it's too specific for your game, accourse.
Title: Re: Checking key pressed in repeatedly_execute
Post by: Kinoko on Mon 11/07/2005 02:41:12
Hehe, I already did in my keyboard movement thread :P I used 'is Animating' instead. I haven't run into any problems with it so far.