Skip to content

Instantly share code, notes, and snippets.

@oO0oO0oO0o0o00
Last active April 28, 2024 15:41
Show Gist options
  • Save oO0oO0oO0o0o00/df42efb293922fae43c0fae3fdeb1a10 to your computer and use it in GitHub Desktop.
Save oO0oO0oO0o0o00/df42efb293922fae43c0fae3fdeb1a10 to your computer and use it in GitHub Desktop.
Play piano in Music Maker Mod of Minecraft with custom key bindings. Semi-automatical recording supported as well.
; Win + A to loop among: recording mode, active, and inactive.
; recording: write clicks to recording.txt
#Requires AutoHotkey v2.0
mode := "inactive"
kiss := [
["a", 1732, 494],
["s", 1793, 500],
["d", 1856, 492],
["f", 1889, 492],
["g", 1953, 487],
["h", 2017, 489],
["j", 2079, 487],
["q", 2119, 473],
["w", 2179, 473],
["e", 2252, 476],
["r", 2278, 474],
["t", 2336, 475],
["y", 2405, 476],
["SC016", 2475, 475],
["1", 960, 880] ,
["2", 1013, 881],
["3", 1080, 882],
["4", 1117, 883],
["5", 1176, 888],
["6", 1241, 892],
["7", 1306, 892],
]
for key, item in kiss {
HotKey item[1], Click.Bind(item[2], item[3], "Down")
HotKey Format("{:s} Up", item[1]), ReleaseMouse.Bind(item[2], item[3])
}
Toggle()
#A::
{
global mode
global kiss
if (mode = "inactive") {
mode := "recording"
ToolTip("🔴 Recording")
} else if (mode = "recording") {
mode := "active"
ToolTip("✅ Active")
} else if (mode = "active") {
mode := "inactive"
ToolTip("❌ Inactive")
}
Toggle()
SetTimer RemoveToolTip, 500 ; Remove tooltip after 1.5 seconds
}
~LButton::
{
global mode
if (mode = "recording") {
MouseGetPos &mouseX, &mouseY
FileAppend Format("[`"`", {:d}, {:d}],`n", mouseX, mouseY), "recording.txt"
}
}
Toggle() {
global mode
global kiss
action := mode = "active" ? "On" : "Off"
for key, item in kiss {
HotKey item[1], action
HotKey Format("{:s} Up", item[1]), action
}
}
RemoveToolTip()
{
SetTimer , 0 ; Turn off the timer
ToolTip ; Remove the tooltip
}
ReleaseMouse(x, y, *) {
MouseGetPos &mouseX, &mouseY
if x = mouseX and y = mouseY {
Click "Up"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment