Jump to content
Sign in to follow this  
Arterie

Move while key is pressed

Recommended Posts

Arterie

I am currently working on a little game, but i cant make my rectangle move "properly".

If i use HotKeySet or _IsPressed function and want it to move while i pressed A it moves like this A AAAAAAAA.

But i want it to move like this AAAAAAAAA.

Is there a Dll or UDF witch could help me?

Sry for my english, i hope you understand my problem^^

Share this post


Link to post
Share on other sites
Monamo

I am currently working on a little game, but i cant make my rectangle move "properly".

If i use HotKeySet or _IsPressed function and want it to move while i pressed A it moves like this A AAAAAAAA.

But i want it to move like this AAAAAAAAA.

Is there a Dll or UDF witch could help me?

Sry for my english, i hope you understand my problem^^

What you're encountering is the keyboard "Repeat Delay" setting (Control Panel -> Keyboard Settings). There is a default delay when pressing a keyboard key before it automatically repeats the keypress activity.

As for DLL/UDF access to a modification of this property, I'm unsure - but hopefully this information will help narrow down your search criteria.


- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Share this post


Link to post
Share on other sites
Arterie

I found a function on msdn. Called GetAsyncKeyState. It can return wether the key is currently hold down or not. Maybe this is what i need, but i got problems with the DllCall now.

$dll = DllOpen("user32.dll")
$result = DllCall($dll,"SHORT","GetAsyncKeyState","Int","0x41")
DllClose($dll)

http://msdn.microsoft.com/en-us/library/ms646293(VS.85).aspx

EDIT

Solved this on my own:

Func _GetAsyncKeyState($key)
    $key = DllCall("user32.dll", "int", "GetAsyncKeyState", "int", $key)
    Return $key[0]
EndFunc
Edited by Arterie

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.