Void FASTCALL GameKeyDown(BYTE Hotkey)
{
if (Hotkey == V_Something)
{
if (ClientReady(TRUE) && !GetUIVar(UI_CHAT) && !InTown(Me))
Something();
}
}
v_something would be set in a configuration or setting file
if you press the key it executes the function but my problem is that
if i where to hold the hotkey it would work the first time then it would pause for a noticeable amount of time ill say 1 second and then it will continue doing the function with out any more delay. Not sure if it is my method or my code :S thx in advance ^^
First off, I believe this is either Windows API or some sort of toolkit. The reason the button press has a delay before repeating is because of how the OS handles keyboard input (or could be your keyboard driver as well). I've gone to notepad and held the a button down before and after a noticable .25 seconds, it started to repeat itself. I've done it on other systems with a similar result, but using a different keyboard. There is a few ways you can handle this though.
If you want it to only happen once, you can detect when the user first presses the key or when they release it.
If you want it to happen repeatedly, you can set a "hotkey" flag (bool) for when the user first presses the key, then turn the flag off for when the release it.
It all depends on what you're using there (It doesn't look familiar to me).