From f5a678331b1ef4bf381a40df8a75b95a90a4e58b Mon Sep 17 00:00:00 2001 From: Mar Alegre Date: Wed, 17 Mar 2021 23:30:59 -0400 Subject: [PATCH] updated minecraft script to use alt --- lib/Prelude.ahk | 2 +- lib/Wrapper.ahk | 16 +++++ src/AutoSave.ahk | 3 +- src/{Basic.ahk => AutorunAutoclick.ahk} | 0 ...{Dark_Souls_III.ahk => Dark Souls III.ahk} | 0 src/Minecraft Bedrock Edition.ahk | 66 ++++++++++++++++++ src/Minecraft.ahk | 67 ------------------- src/{Outer_Wilds.ahk => Outer Wilds.ahk} | 0 8 files changed, 84 insertions(+), 70 deletions(-) create mode 100644 lib/Wrapper.ahk rename src/{Basic.ahk => AutorunAutoclick.ahk} (100%) rename src/{Dark_Souls_III.ahk => Dark Souls III.ahk} (100%) create mode 100644 src/Minecraft Bedrock Edition.ahk delete mode 100644 src/Minecraft.ahk rename src/{Outer_Wilds.ahk => Outer Wilds.ahk} (100%) diff --git a/lib/Prelude.ahk b/lib/Prelude.ahk index ee58537..35d4923 100644 --- a/lib/Prelude.ahk +++ b/lib/Prelude.ahk @@ -3,7 +3,7 @@ ; ; Set default location and name convention for compiled scripts to use -;@Ahk2Exe-ExeName %A_MyDocuments%\AutoHotkey\bin\AHK-%A_ScriptName% +;@Ahk2Exe-ExeName %A_MyDocuments%\AutoHotkey\bin\%A_ScriptName% ; Install hooks to make sure script can get physical state of keys instead of logical state. #InstallKeybdHook diff --git a/lib/Wrapper.ahk b/lib/Wrapper.ahk new file mode 100644 index 0000000..b1233e0 --- /dev/null +++ b/lib/Wrapper.ahk @@ -0,0 +1,16 @@ +; +; Turn script into wrapper for a program +; + +CheckWinExist(Window) { + if !WinExist(Window) { + ExitApp + } +} + +Run %WrapperPath% +WinWait %WrapperWindow% + +; Check if window exists once per second +WrapperFunc := Func("CheckWinExist").bind(WrapperWindow) +SetTimer, %WrapperFunc%, 1000 \ No newline at end of file diff --git a/src/AutoSave.ahk b/src/AutoSave.ahk index cd89fd4..4b6dcda 100644 --- a/src/AutoSave.ahk +++ b/src/AutoSave.ahk @@ -20,5 +20,4 @@ Autosave: Sleep 50 Send {s up} Sleep 50 - Send {Ctrl up} - SetTimer, Autosave, On \ No newline at end of file + Send {Ctrl up} \ No newline at end of file diff --git a/src/Basic.ahk b/src/AutorunAutoclick.ahk similarity index 100% rename from src/Basic.ahk rename to src/AutorunAutoclick.ahk diff --git a/src/Dark_Souls_III.ahk b/src/Dark Souls III.ahk similarity index 100% rename from src/Dark_Souls_III.ahk rename to src/Dark Souls III.ahk diff --git a/src/Minecraft Bedrock Edition.ahk b/src/Minecraft Bedrock Edition.ahk new file mode 100644 index 0000000..94d9e1b --- /dev/null +++ b/src/Minecraft Bedrock Edition.ahk @@ -0,0 +1,66 @@ +; Script can be directly run by or compiled into an .exe by the open-source software AutoHotkey +; https://www.autohotkey.com + +; +; Front Matter +; + +; Include relevant libraries +#Include ../lib/Prelude.ahk +#Include ../lib/HoldRepeat.ahk + +; Make this a wrapper script +WrapperPath:="shell:AppsFolder\Microsoft.MinecraftUWP_8wekyb3d8bbwe!App" +WrapperWindow:="Minecraft" +#Include ../lib/Wrapper.ahk + +; +; Hotkeys +; + +; Remap LAlt so it doesn't active Minecraft's Alt+Space menu shortcut +#InputLevel 1 +*LAlt::vkFF +#InputLevel 0 +vkFF & Tab:: +Send {Alt down} +Send {Blind}{Tab} +SetTimer, AltUp, -1 +return +AltUp: +KeyWait LAlt +Send {Alt up} +return + +; Hold/Autoclick mouse buttons +; Holds if single click, autoclicks if double click +vkFF & LButton UP::HoldOrRepeat("LButton",["RButton","MButton"]) +vkFF & RButton UP::HoldOrRepeat("RButton",["LButton","MButton"]) + +; Autorun +vkFF & w UP::Hold("w",["s"]) +vkFF & s UP::Hold("s",["w"]) +vkFF & a UP::Hold("a",["d","w","s"]) +vkFF & d UP::Hold("d",["a","w","s"]) + +; Hold crouch +vkFF & Shift UP::Hold("Shift",["Ctrl"]) + +; Autojump/auto-ascend +vkFF & Space UP::Hold("Space",["Shift"]) + +; Mouse button 4: auto-takeoff +; Macro assumes you have your fireworks in the first hotbar slot +XButton1:: +Loop, 5 { + Send {Space down} + Sleep 10 +} +Send {Space up}1 +Sleep 225 +Loop, 5 { + Send {Space down} + Sleep 10 +} +Send {Space up}{RButton} +return \ No newline at end of file diff --git a/src/Minecraft.ahk b/src/Minecraft.ahk deleted file mode 100644 index bf40bb6..0000000 --- a/src/Minecraft.ahk +++ /dev/null @@ -1,67 +0,0 @@ -; Script can be directly run by or compiled into an .exe by the open-source software AutoHotkey -; https://www.autohotkey.com - -; -; Front Matter -; - -; Include relevant libraries -#Include ../lib/Prelude.ahk -#Include ../lib/HoldRepeat.ahk - -; Only do hotkeys if relevant window is active -#If WinActive("Minecraft") - -; -; Hotkeys -; - -; Tab will be the hotkey -~Tab::return - -*!RButton:: -Send {RButton} -Sleep 100 -Send {Esc down} -Sleep 50 -Send {Esc up} -return - -; Hold/Autoclick mouse buttons -; Holds if single click, autoclicks if double click -Tab & LButton UP::HoldOrRepeat("LButton",["RButton","MButton"]) -Tab & RButton UP::HoldOrRepeat("RButton",["LButton","MButton"]) - -; Autorun -Tab & w UP::Hold("w",["s"]) -Tab & s UP::Hold("s",["w"]) -Tab & a UP::Hold("a",["d","w","s"]) -Tab & d UP::Hold("d",["a","w","s"]) - -; Hold crouch -Tab & Shift UP:: -if GetKeyState("Alt","P") { - Hold("Shift",["Ctrl"]) -} else { - Hold("Shift",["Ctrl","Space"]) -} -return - -; Autojump/auto-ascend -Tab & Space UP::Hold("Space",["Shift"]) - -; Mouse button 4: auto-takeoff -; Macro assumes you have your fireworks in the first hotbar slot -XButton1:: -Loop, 5 { - Send {Space down} - Sleep 10 -} -Send {Space up}1 -Sleep 225 -Loop, 5 { - Send {Space down} - Sleep 10 -} -Send {Space up}{RButton} -return \ No newline at end of file diff --git a/src/Outer_Wilds.ahk b/src/Outer Wilds.ahk similarity index 100% rename from src/Outer_Wilds.ahk rename to src/Outer Wilds.ahk