Logo135.png We're building a new wiki, so information on this page may be out of date.

We'd love for you to help us out!

AutoHotkey/Scripts

From SourceRuns
Jump to: navigation, search

We highly recommend using Source Pause Tool for autojump, duckspam and other functionality as it's tick-perfect compared to AutoHotkey.
Only use these when SPT doesn't work for your game/mod.


This page stores AutoHotkey scripts as well as in-game scripts used for speedrunning on Source Engine. To add a script into your AutoHotkey, find AutoHotkey.ahk in your "Documents" folder after installing AHK. Open the file with notepad or other text editing software, and place the scripts there. After that, you may need to restart AHK or Reload your script.

Backwards Circle Jump Script

Unsprints, jumps, cancels going backwards and starts walking on one key press. Used for backwards circle jumps in new engine HL2.

 alias +backhop "-back; -speed; +walk; +jump"
 alias -backhop "-jump; -walk"
 bind space +backhop // Change the key if needed

Forwards Circle Jump Script

Forwards version of the script above. Slightly worse due to having to hold backwards for one tick. DO NOT USE IN OLD ENGINE.

 alias +fronthop "-forward; +back; -speed; +walk; +jump; wait 5; -back"
 alias -fronthop "-jump; -walk"
 bind space +fronthop // Change the key if needed

Bunnyhopping Script

This script is used for bunnyhopping on every game with Source Engine. Basically, it rapidly sends SPACE inputs, which allows you to bunnyhop, while holding space. Using Source Pause Tool is recommended over this as it is tick perfect.

*SPACE::
Loop
{
if !GetKeyState("Space", "P")
break
Send {Blind}{Space}
Sleep 10
}
return

Wallclimbing/Flying Script

Script used for Wallclimbing and/or Flying in the 2007 engine, bound to the key C.

*c::
Loop
{
GetKeyState,state,c,P,SPACE
if state = U
break
Send, {Blind}{e}{SPACE}
Sleep,10
}
return

Jclip Script

Script used for Jclip trick in the 2004 Engine version of Half-Life 2, bound to the key H.

*h::
Loop
{
GetKeyState, state,h , P
if State = U
break
; Otherwise:
Send, {CTRL}
Sleep, 1
Send, {j}
break
}

Ladderspeeding Script

Script used for Ladderspeeding trick in Half-Life 2, bound to TAB.

*Tab::
Loop
{
GetKeyState, state, Tab, P
if State = U
break
Send, {blind}{Space}{lctrl}
Sleep, 10
}
return

Enable/Disable

These scripts will mess up your keys and may prevent alt tabbing or even closing the game if you rebind Esc. It will also prevent you from alt tabbing.
Adding this line to the top of your script will allow you to enable and disable your script by pressing F7, so you can alt tab and chat:

*F7:: Suspend, Toggle

You can also use this tag above your every script, which will automatically enables the script when the specific Window is active. Some people my find it easier to work with, since you don't have to press a button each time you want to write something in a chat or so. This tag will not stop the script if you enter Steam Overlay In-Game.

#IfWinActive HALF-LIFE 2
;Put your macros here.
#IfWinActive

Example: #IfWinActive HALF-LIFE 2

However, you'll have to duplicate the same script for each Window (game), in order for it to work with the games you want to. If the script has the tag above it, it'll only work when the specified Window is active, and won't work anywhere else

Notes

  • These scripts assume you use the default controls ingame. For a customized key config, you will have to change some keys in the AHK script as well.
  • Sometimes when using host_timescale, the scripts may stop working. If that's the case, change the Sleep number from 10 to 40.

An example complete script:

 *f7:: Suspend, Toggle
 ;; Regular bunnyhop/abh script for any source game, assuming jump is mapped to Space.
 *Space::
 Loop
 {
 GetKeyState, state, Space, P
 if State = U
 break
 ; Otherwise:
 Send, {blind}{Space}
 Sleep, 10 ;; Change this number to 40 or 60 or some other increment of 10  or 15 if the script does not work.
 }
 return
 ;; Wallclimb/propfly. Assuming Space is jump and E is use.
 *CapsLock::
 Loop
 {
 GetKeyState, state, CapsLock, P
 if State = U
 break
 ; Otherwise:
 Send, {blind}{Space}e
 Sleep, 10
 }
 return
 ;; Ladderboosting. Assuming jump is mapped to space and crouch is mapped to Ctrl.
 ;~*Tab::
 Loop
 {
 GetKeyState, state, Tab, P
 if State = U
 break
 ; Otherwise:
 Send, {blind}{Space}{lctrl}
 Sleep, 10
 }
 return
 ;; Crouchspam. Assuming crouch is mapped to Ctrl. 
 ;*LButton::
 Loop
 {
 GetKeyState, state, LButton, P
 if State = U
 break
 ; Otherwise:
 Send, {blind}{lctrl}
 Sleep, 10
 }
 return
 

Credit: ~S.

External Links

AutoHotkey homepage
event app

List of keys and buttons on the AutoHotkey site

Personal tools