Jump to content

Why isn't this simple script working?


Recommended Posts

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

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

Link to comment
Share on other sites

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

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

Link to comment
Share on other sites

  • Moderators

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!

Link to comment
Share on other sites

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 =)!

 

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