Sign in to follow this  
Followers 0
Suxen

Waiting until a key is released?

4 posts in this topic

#1 ·  Posted (edited)

I'm writing a few macros for a game I play, it presses key combinations for me as the game's own in built method for quickly accessing features is too limited (anyone played NWN? that's the one I'm talking about). Anyway, a simple script for example:

HotKeySet("!s", "nwnStealth")

While 1
    Sleep(100)
WEnd

Func nwnStealth()
    Send("{NUMPAD0}{NUMPAD4}{NUMPAD4}")
EndFunc

Now the big kicker is that the game then thinks the key is still pressed down for some strange reason. You can add a sleep delay, but that relies on quick fingers. What I really need is a way to script a while loop, which waits until the alt or control keys are no longer being pressed down. Is this possible? I can't seem to find a function which would do what I'm after. There's MouseDown.. but no KeyDown. There's also _IsPressed, but that seems like a past tense check. Sure, it might have been pressed - maybe twice. I just need to know when it is released.

Edited by Suxen

Share this post


Link to post
Share on other sites



have you looked at the relevant option settings ?

SendKeyDelay

SendKeyDownDelay


Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites

I did indeed. Turns out _IsPressed is what I was after, though. I guess I'll live and learn on testing stuff properly.

Share this post


Link to post
Share on other sites

I did indeed. Turns out _IsPressed is what I was after, though. I guess I'll live and learn on testing stuff properly.

Please post the code in this thread when you complete it.

Thanks.

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  
Followers 0