Jump to content

_IsPressed !?


Rad
 Share

Recommended Posts

I was searching the forums trying to find a condition for if your still holding down a key, I already have my hotkey set up so when you press down it has msgbox that says "Down" so that works. Now I want my "ship" to fly down when I press down, I can manage making it move on my own, but how would i make it keep moving untill you stop pressing down?

I can just make it change when you press left/right/up so you cant stop, but then I cant make it fly at angles!

How do you get the _IsPressed(xx) functions? It crashes when I use it :lmao:

Link to comment
Share on other sites

I made a little drawing program a long time ago that let me move lines and stuff (for various reasons). If you have a hotkey function, holding the key should repeatedly call the function. At least it did when I used it.

As for _IsPressed(), you need misc.au3 (beta is useful too). If you couldn't tell that from what you were doing, you most likely don't have Scite either. If that was a correct assumption, get Scite. It's damn useful.

P.S. @Oxin8: Fast posting for the win!

Edited by greenmachine
Link to comment
Share on other sites

OH Nevermind I wasnt putting the little ' marks around my number hehe

fyi all you need is:

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

 Return $bRv
EndFunc;==>_IsPressed

I had a big example and stripped this down, now it works pretty good...

And what is Scite? :lmao:

Edited by Rad
Link to comment
Share on other sites

the help file is great.... learning on the fly...

#Include <Misc.au3>
$dll = DllOpen("user32.dll")
While 1
If _IsPressed("25",$dll) Then;move left
If _IsPressed("26",$dll) Then;move up
If _IsPressed("27",$dll) Then;move right
If _IsPressed("28",$dll) Then;move down
Wend
DllClose($dll)

That help?

Link to comment
Share on other sites

Im using crimson editor... It looks almost EXACTLY the same except Im on XP which makes that look like an ancient program xD

http://www.crimsoneditor.com/

Err with the dark grey menus etc

What's the deal with those menus... it's like that in Java, is that just some sort of Java-specific window appearance? Or is it built in and just used for certain things that don't like the XP feel. I'm not a big fan of Java windows, they don't look right to me after a couple years of WinXP.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...