Jump to content

Quick question


Recommended Posts

Global $Paused = 0
HotKeySet("{F2}", "wp")

While 1
If $Paused = 1 Then
If _IsPressed('02') = 1 Then 
Shoot()
EndIf
EndIf
WEnd

Func Shoot()
    If _IsPressed('01') = 1 Then 
    Sleep(10)
    msgBox(4096, "Test", "Works")
    ;Send("{ALT}")
    ;Send("{ALT}")
EndIf
EndFunc


Func wp()
    If $Paused = 0 Then
        $Paused = 1
    Else
        $Paused = 0
    EndIf
EndFunc


Func _IsPressed($hexKey)
 ; $hexKey must be the value of one of the keys.
 ; _IsPressed will return 0 if the key is not pressed, 1 if it is.
 ; $hexKey should entered as a string, don't forget the quotes!
 ; (yeah, layer. This is for you)
 
  Local $aR, $bO
 
  $hexKey = '0x' & $hexKey
  $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)
  If Not @error And BitAND($aR[0], 0x8000) = 0x8000 Then
     $bO = 1
  Else
     $bO = 0
  EndIf
 
  Return $bO
EndFunc  ;==>_IsPressed

My question is, why won't this script work.. It's been a few months since I've worked with Autoit, but all seems well.

If you put a MsgBox instead of Shoot() it works fine.

What I need it to do is, when F2 hotkey is hit, it will ispressed the right mouse button, if thats pressed, then it goes on to see if the left mouse is pressed. If the left mouse button is pressed it will send ALT twice.

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Link to comment
Share on other sites

  • Moderators

Does the game accept send commands / is the game/window active?

Send('{ALT 2}') is the same as

Send('{ALT}')

Send('{ALT}') btw...

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Yes it does. Still isn't working for me. Spyrorocks, do you have any idea whats going on?

Edited by Sardith

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Link to comment
Share on other sites

Is there any way to hotkeyset the right mouse button?

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

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...