Jump to content

Recommended Posts

Posted (edited)

I want the ''e'' button to hold down ''s'' and ''f'' when it's down and release ''s'' and ''f'' when its released. What am I doing wrong?

HotKeySet("e down","sf1")
HotKeySet("e up","sf2")

While(1)
WEnd

Func sf1()
Send("{s down}")
Send("{f down}")
EndFunc

Func sf2()
Send("{s up}")
Send("{f up}")
EndFunc

Edit: noticed i posted in the wrong section.

Edited by SugarplumChum
Posted

I want the ''e'' button to hold down ''s'' and ''f'' when it's down and release ''s'' and ''f'' when its released. What am I doing wrong?

HotKeySet("e down","sf1")
HotKeySet("e up","sf2")

While(1)
WEnd

Func sf1()
Send("{s down}")
Send("{f down}")
EndFunc

Func sf2()
Send("{s up}")
Send("{f up}")
EndFunc

Posted (edited)

Does this work?

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
    Sleep(10)
    ; If E key is pressed hold key S & F down until E is released
    If _IsPressed("45", $dll) Then
        Send("{s down}") ;Holds the s key down
        Send("{f down}") ;Holds the f key down
        While _IsPressed("57", $dll)
            Sleep(10)
        WEnd
    EndIf
WEnd

https://www.autoitscript.com/autoit3/docs/keywords/IfElseEndIf.htm

https://www.autoitscript.com/autoit3/docs/libfunctions/_IsPressed.htm

https://www.autoitscript.com/autoit3/docs/functions/Send.htm

Edited by aa2zz6
Posted
6 minutes ago, aa2zz6 said:

Does this work?

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
    Sleep(10)
    ; If E key is pressed hold key S & F down until E is released
    If _IsPressed("45", $dll) Then
        Send("{s down}") ;Holds the s key down
        Send("{f down}") ;Holds the f key down
        While _IsPressed("57", $dll)
            Sleep(10)
        WEnd
    EndIf
WEnd

https://www.autoitscript.com/autoit3/docs/keywords/IfElseEndIf.htm

https://www.autoitscript.com/autoit3/docs/libfunctions/_IsPressed.htm

https://www.autoitscript.com/autoit3/docs/functions/Send.htm

It holds s & f down but they dont get released when i release ''e''

  • Moderators
Posted

Threads merged, please stick to one in the future. Also, be sure you have read the forum rules to which you were previously pointed; a second thread on gaming would not bode well for you.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Posted (edited)
57 minutes ago, aa2zz6 said:

Change the while loop to this:

While _IsPressed("45", $dll)
            Sleep(10)
        WEnd

 

Same thing, I have to press s and f for them to be released again when i need them be released on ''e up''

Edited by SugarplumChum
Posted
15 minutes ago, JLogan3o13 said:

Threads merged, please stick to one in the future. Also, be sure you have read the forum rules to which you were previously pointed; a second thread on gaming would not bode well for you.

Sorry my bad, wont happen again :).

Posted

Fixed it =)

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
    ; If E key is pressed hold key S & F down until E is released
    If _IsPressed("45", $dll) Then
        Send("{s down}") ;Holds the s key down
        Send("{f down}") ;Holds the f key down
        While _IsPressed("45", $dll)
            Sleep(10)
        WEnd
        Send("{s up}");
        Send("{f up}");
    EndIf
WEnd

Thank you aa2z6 for you help =)!

 

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