Log:BMD AHK (Meta, no ontology)

From Compile Worlds

Use this script to play Bunny Must Die. It helps. A LOT.

Unfortunately not as much as it could, since for whatever stupid fucking reason you can't block the up key.

#MaxHotkeysPerInterval 20000
#UseHook

KeyInit("Left")
KeyInit("Right")
KeyInit("Up")
KeyInit("x")
RunWait "H:\hayate\archive\bin\win32\bmd\bmd.exe", H:\hayate\archive\bin\win32\bmd
ExitApp
Exit

*f::z
*s::c

KeyInit(button)
{
	global
	vKey%button% = Up
	vForce%button% =
}

KeyDown(button)
{
	global
	vKey%button% = Down
	If (vForce%button% = "")
	{
		Send, {%button% Down}
	}
}

KeyUp(button)
{
	global
	vKey%button% = Up
	If (vForce%button% = "")
	{
		Send, {%button% Up}
	}
}

KeyState(button)
{
	global
	return (vKey%button% = "Down")
}

ForceDown(button)
{
	global
	If (vForce%button% = "Up") || ((vForce%button% = "") && (vKey%button% = "Up"))
	{
		Send, {%button% Down}
	}
	vForce%button% = Down
}

ForceUp(button)
{
	global
	If (vForce%button% = "Down") || ((vForce%button% = "") && (vKey%button% = "Down"))
	{
		Send, {%button% Up}
	}
	vForce%button% = Up
}

ForceOff(button)
{
	global
	If (vForce%button% != "") && (vForce%button% != vKey%button%)
	{
		t := vKey%button%
		Send, {%button% %t%}
	}
	vForce%button% =
}


*a::
Dash := 1
ForceUp("x")
ForceUp("Up")
Exit

*a Up::
Dash := 0
ForceOff("x")
ForceOff("Up")
Exit

*Right::
If (KeyState("Right"))
	Exit
KeyDown("Right")
If (Dash >= 1)
{
	ForceDown("Right")
	Sleep, 20
	ForceUp("Right")
	Sleep, 20
	ForceDown("Right")
	Sleep, 20
	ForceOff("Right")
	ForceOff("x")
	ForceOff("Up")
}
Exit

*Right Up::
If (!KeyState("Right"))
	Exit
KeyUp("Right")
Exit

*Left::
If (KeyState("Left"))
	Exit
KeyDown("Left")
If (Dash >= 1)
{
	ForceDown("Left")
	Sleep, 20
	ForceUp("Left")
	Sleep, 20
	ForceDown("Left")
	Sleep, 20
	ForceOff("Left")
	ForceOff("x")
	ForceOff("Up")
}
Exit

*Left Up::
If (!KeyState("Left"))
	Exit
KeyUp("Left")
Exit

*d::
If (KeyState("x"))
	Exit
KeyDown("x")
Exit

*d Up::
If (!KeyState("x"))
	Exit
KeyUp("x")
If (Dash >= 1) {
	ForceUp("x")
	ForceUp("Up")
}
Exit

*Up::
If (KeyState("Up"))
	Exit
KeyDown("Up")
Exit

*Up Up::
If (!KeyState("Up"))
	Exit
KeyUp("Up")
Exit