Sign in to follow this  
Followers 0
El-Trucha

Know if a key is pressed?

7 posts in this topic

OK...I wanna make a game and I wanna know when a key is pressed so that the character moves...

How??

Thanx!! :lmao:


El-Truchahttp://www.truchasoft.tk[url="ftp://tsfc.homeftp.net"]ftp://tsfc.homeftp.net[/url]hotline://tsfc.ath.cx

Share this post


Link to post
Share on other sites



OK...I wanna make a game and I wanna know when a key is pressed so that the character moves...

How??

Thanx!! :lmao:

<{POST_SNAPBACK}>

UDF:

_IsPressed or something like that.

Search the forum for the keylogger script that's been floating around.


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

I tried this and it didnt work:

#include <string.au3>

While 1
    If _IsPressed(_StringToHex("n")) Then
        MsgBox(64, "See", "n was pressed")
    EndIf
WEnd

Func _IsPressed($hexKey)
    Local $aR, $bRv
    $hexKey = '0x' & $hexKey
    $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)
    If $aR[0] <> 0 Then
        $bRv = 1
    Else    
        $bRv = 0
    EndIf
      Return $bRv
EndFunc

I pressed "n" and it didnt work...why??

Thanx!! :lmao:


El-Truchahttp://www.truchasoft.tk[url="ftp://tsfc.homeftp.net"]ftp://tsfc.homeftp.net[/url]hotline://tsfc.ath.cx

Share this post


Link to post
Share on other sites

Nvm, it worked now... :lmao:

Thanx all!! o:)


El-Truchahttp://www.truchasoft.tk[url="ftp://tsfc.homeftp.net"]ftp://tsfc.homeftp.net[/url]hotline://tsfc.ath.cx

Share this post


Link to post
Share on other sites

instead of loading a dll, then unloading it... why not just use HotKeySet :lmao: with the latest beta you can do like HotKeySet ("a", "MyFunc") instead of Ctrl+a...


FootbaG

Share this post


Link to post
Share on other sites

U CAN do that now?? I didnt know about that!! thanx!! :lmao:


El-Truchahttp://www.truchasoft.tk[url="ftp://tsfc.homeftp.net"]ftp://tsfc.homeftp.net[/url]hotline://tsfc.ath.cx

Share this post


Link to post
Share on other sites

no problem :lmao:


FootbaG

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