Jump to content

Need help with something simple


Recommended Posts

Well it is for a game I play, Left 4 Dead, and was wondering if I could get some help with something. I want to be able to have a script running and when you hit a key, say 'N' it executes the script. So far I have

$c = 1

;Run("notepad.exe")

;sleep (500)

while $c < 31

Send("{r}")

;Send("{ENTER}")

$c = $c +1

wend

yeah ignore the comments that was me just trying to figure stuff out. Been reading the faqs and tutorials but I must have missed the part over what I am wanting to do.

Link to comment
Share on other sites

Use For..Next if you know how many iterations the loop should preform, and overall start with AutoIt-1-2-3 to get a better understanding of the language and it's functions:

HotKeySet('{ESC}', '_EXIT')
HotKeySet('n', 'SayN')

While 1
    Sleep(100)
WEnd

Func _EXIT()
    Exit
EndFunc

Func SayN()
    For $i = 1 To 30
        Send('r')
    Next
EndFunc
Link to comment
Share on other sites

hotkeyset()? In this case Win+n will start the routine

HotKeySet("#n","mainroutine")

While 1
    sleep(500)
WEnd
    
Func mainroutine()
    $c = 1
    ;Run("notepad.exe")
    ;sleep (500)
    while $c < 31
        Send("{r}")
        ;Send("{ENTER}")
        $c = $c +1
    Wend
EndFuncoÝ÷ Ø l¢+,)Ê¡j÷§^{e¢S¯+aÆ®¶­sdgVæ2Öç&÷WFæR µ'VâgV÷C¶æ÷FWBæWRgV÷C² ·6ÆVWS¦f÷"b33c¶3ÓFò3 6VæBgV÷C··'ÒgV÷C² µ6VæBgV÷C·´TåDU'ÒgV÷C²¤æW@¤VæDgVæ
Link to comment
Share on other sites

Ahh thank you for the help. It has gotten me on the right track. I will have to play around with it tomorrow on a different pc though. I have a very funky version of windows that does not respond to many keyboard commands (too lazy to format and re-install). For those that actually play left 4 dead this is what I am trying to do... Have a script running so that if you are being mobbed and are on the ground, unload your akimbo pistols as fast as possible. The pistols can fire faster than I can click a mouse button so I want to find out how fast they can really fire.

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