Expedite pack animal gear unload

Started by rkagerer, June 28, 2019, 11:37:20 PM

Previous topic - Next topic

rkagerer

I have an A17 game where I'm regularly doing caravans with 100+ pack animals.  I know you can drop all of an animal's gear at once by clicking them and using the Gear / Drop buttons.  This saves a lot of pawn effort if you move all your animals to the desired stockpile, first.

But it's tedious cycling through each animal individually to do this.  Worse, since the animals you're selecting tend to be in one area of your screen (probably the center), and the buttons in another (closer to the bottom left corner), you're constantly moving your mouse back and forth.  With more than a trivial number of pack animals, it's repetitive strain injury just waiting to happen.

I'd love a mod that let's you issue a "Drop All Gear" order, then draw a highlight over all the pack animals you want to execute it.  Let me know if you come across something like that.

Even a simple hotkey or two would help (I submitted a mod request but nobody was interested).

In the meantime, if you're feeling my pain, here's an AutoHotKey script to help.  It captures CTRL+G and CTRL+D keypresses, and makes them click the "Gear" and "Drop" buttons respectively.  It's a poor man's hotkey, that works by blind-clicking the coordinates where the buttons are expected.  So only press them in the appropriate situations (i.e. CTRL+G if you have a pack animal with gear selected, and CTRL+D after that).

The script has only been minimally tested so far.  You might need to adjust the coordinates for your game version and screen size.  I'm using it and I love it.


;-----------------------------------------------------------------------------------------------------------------------
; RIMWORLD
;-----------------------------------------------------------------------------------------------------------------------

; If coordinate component is positive, use it directly.  If negative, click that far from right/bottom edge.
rimClickHelper(X, Y) {
  local orgX, orgY, winWidth, winHeight
  MouseGetPos, orgX, orgY
  WinGetPos, , , winWidth, winHeight, RimWorld by Ludeon Studios
  if (X < 0)
    X := winWidth + X
  if (Y < 0)
    Y := winHeight + Y
  SendEvent {Click %X%, %Y%}
  MouseMove, %orgX%, %orgY%, 0
}

#IfWinActive, RimWorld by Ludeon Studios ahk_class UnityWndClass
  ^g::
    rimClickHelper(181, -216) ; click Gear button (assumes animal with gear already selected)
    Return
  ^d::
    rimClickHelper(396, -571) ; click first Drop button (assumes gear already showing)
#IfWinActive