Jump to content

BunnyHop


Recommended Posts

Hi. I tried to do a bunny hop script for a free source code game (so i think it's legally)

Global $Paused
HotKeySet("{SPACEDOWN}", "Start")
HotKeySet("{SPACEUP}", "Stop")
HotKeySet("{ESC}", "Terminate")

While 1
Sleep(100)
WEnd

Func Start()
While 1
Send("{SPACE}")
Sleep(50)
Send("{SPACE}")
Sleep(50)
WEnd
EndFunc

Func Stop()
$Paused = NOT $Paused
While $Paused
sleep(100)
ToolTip('Script is "Paused"',0,0)
WEnd
ToolTip("")
EndFunc

Func Terminate()
Exit 0
EndFunc

So the question: How can i solve it the spacebar hold and relase? (because {spaceup} and {spacedown} isn't good :idea: )

Link to comment
Share on other sites

I would do it more like this:

#include <Misc.au3>

Local $hDll = DllOpen("user32.dll"), $iPaused = False
HotKeySet("!{ESC}", "_Terminate")
HotKeySet("!{PAUSE}", "_Pause")

While 1
    Sleep(10)
    If $iPaused <> True And _IsPressed("20", $hDll) Then
        Send("{SPACE UP}")
        Send("{SPACE DOWN}")
        Sleep(10)
    EndIf
WEnd

Func _Pause()
    $iPaused = Not $iPaused
EndFunc

Func _Terminate()
    Exit 0
EndFunc   ;==>Terminate
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...