Untitled
unknown
plain_text
23 days ago
2.6 kB
1
Indexable
Never
#SingleInstance force ; Ensure only one instance of the script is running #Requires AutoHotkey v2.0+ ; Require AutoHotkey version 2.0 or higher Activated := True Insert:: { global Activated Activated := !Activated ToolTip (Activated ? "ACTIVATED.`nPress Insert to toggle." : "DEACTIVATED.`nPress Insert to toggle."), 300, 200 SetTimer(() => ToolTip(), -1000) return } ; Define the relative coordinates for each character form CHAR_PANTHER := { x: -1000, y: 0 } CHAR_BEAR := { x: 1000, y: 0 } CHAR_CHICKEN := { x: -250, y: 1000 } CHAR_HUMAN := { x: 0, y: -1000 } CHAR_RAT := { x: 250, y: 1000 } ; Function to switch characters based on the given character name SwitchCharacter(character := "Panther") { global CHAR_PANTHER, CHAR_BEAR, CHAR_CHICKEN, CHAR_HUMAN, CHAR_RAT ; Press and hold 'q' key to initiate character switch Send("{q Down}") Sleep(50) ; Determine the position based on character name pos := CHAR_%character% if (!pos) { LogError("Unknown character: " . character) Send("{q Up}") ; Ensure 'q' key is released in case of error return } MoveMouseRelative(pos.x, pos.y) Send("{q Up}") } ; Function to perform key presses with error handling PerformKeyPress(key, holdTime := 1) { if (holdTime > 0) { Send("{" . key . " Down}") Sleep(holdTime) Send("{" . key . " Up}") } else { Send("{" . key . "}") } Sleep(50) } ; Function to move mouse relative to current position MoveMouseRelative(x, y, speed := 1) { MouseMove(x, y, speed, "R") Sleep(50) } #HotIf Activated ; Enable hotkeys only when Activated is true ; Hotkey for Rat Door R:: { SwitchCharacter("Rat") Sleep(1) PerformKeyPress("Space") Sleep(30) PerformKeyPress("c") Sleep(700) SwitchCharacter("Human") } ; Hotkey for Chicken Eat Z:: { SwitchCharacter("Chicken") Sleep(350) PerformKeyPress("e") Sleep(2700) SwitchCharacter("Human") } ; Hotkey for Druid Movement XButton1:: { SwitchCharacter("Panther") Sleep(630) PerformKeyPress("Space") Sleep(30) PerformKeyPress("e") Sleep(30) SwitchCharacter("Chicken") Sleep(100) PerformKeyPress("Space") Sleep(100) PerformKeyPress("Space") Sleep(100) PerformKeyPress("Space") Sleep(700) SwitchCharacter("Human") } ; Function to log errors with a timestamp LogError(message) { FileAppend(Format("{1}: {2}`n", A_Now, message), "error.log") } return
Leave a Comment