Jump to content

Know if a key is pressed?

Recommended Posts

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


Thanx!! :lmao:



_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

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")

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

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

Thanx!! :lmao:


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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...