Created
March 4, 2019 18:59
-
-
Save dawsontoth/a48a6318c9e354eab24888eb0902302a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cs ---------------------------------------------------------------------------- | |
Version: v1 | |
Author: Dawson Toth | |
Script Function: | |
Taps the tiny unit deselection arrow in They Are Billions 1 to 10 times. | |
To use, download AutoIt, then drop this in a file named TheyAreBillions-Hotkeys.au3. | |
Run the script, and then whenever you press `, you can then press ESC or ` to cancel, | |
or 1, 2, 3, 4 ... 9, or 0 (which means 10) to left click on the deselect arrow in TAB. | |
Note that this only works when 1 type of unit is selected! So it's useful for sticking | |
Snipers in towers, or spreading out your Titans or Thanatos. | |
Cheers! | |
#ce ---------------------------------------------------------------------------- | |
; Configuration | |
Global $deselectXPercent = 0.34513 ; How far from the left of the screen is the button? | |
Global $deselectYPercent = 0.96777 ; How far from the top of the screen is the button? | |
Global $speed = 1 ; Minimum of 0 (instant). If it is mis-clicking, try setting this to a higher value. | |
Global $findXYPercent = False ; Set this to true to see a tooltip of the X-Y position of your mouse. | |
; You shouldn't need to tweak anything below. But feel free to if you understand what you're doing! | |
Global $deselectingUnits = False | |
; Hot key wiring | |
HotKeySet('`', 'toggleUnitDeselect') | |
; Take over the ` key, which will toggle taking over the number keys for quick deselection. | |
Func toggleUnitDeselect() | |
$deselectingUnits = Not $deselectingUnits | |
For $i = 0 To 9 Step 1 | |
If $deselectingUnits Then | |
HotKeySet(String($i), 'specifyUnitDeselect') | |
Else | |
HotKeySet(String($i)) | |
EndIf | |
Next | |
If $deselectingUnits Then | |
HotKeySet('{ESC}', 'toggleUnitDeselect') | |
ToolTip('How many should we deselect? (1-9, 0 = 10, or ESC to cancel)', 1, 1, 'Unit Deselect') | |
Else | |
HotKeySet('{ESC}') | |
ToolTip('') | |
EndIf | |
EndFunc | |
; Once the number keys are taken over, pressing them will invoke this, which will perform the clicks on that tiny deselection arrow. | |
Func specifyUnitDeselect() | |
Local $howMany = Number(@HotKeyPressed) | |
If $howMany = 0 Then | |
$howMany = 10 | |
EndIf | |
Local $mouseStartedAt = MouseGetPos() | |
MouseMove(@DesktopWidth * $deselectXPercent, @DesktopHeight * $deselectYPercent, $speed) | |
Sleep(1) | |
MouseClick('left', @DesktopWidth * $deselectXPercent, @DesktopHeight * $deselectYPercent, $howMany, $speed) | |
MouseMove($mouseStartedAt[0], $mouseStartedAt[1], $speed) | |
toggleUnitDeselect() | |
EndFunc | |
; Keeps the script alive (use the system tray to exit) | |
While 1 | |
If $findXYPercent Then | |
Local $mouseAt = MouseGetPos() | |
ToolTip('X = ' & String($mouseAt[0] / @DesktopWidth) & ' and Y = ' & String($mouseAt[1] / @DesktopHeight), 1, 1, 'Mouse Position') | |
EndIf | |
Sleep(100) | |
WEnd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment