gghf

Sea of Thieves - Reduce Hold on Items Fix (Advanced)

Oct 8th, 2021 (edited)
1,694
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. CHANGELOG:
  3. 2021-10-23
  4.   - removed keys that are used inside barrel menus, to avoid unwanted 2nd clicks in them:
  5.     "q::", "r::", "f::"
  6. 2021-10-22
  7.   - commented out "q::"
  8. 2021-10-21
  9.   - added function "UndoActiveToggle()"
  10.   - inserted function "UndoActiveToggle()" to relevant keys
  11.   - minor refactor to toggle off keys
  12.   - changed "k" to "NumpadDiv" (/) to avoid toggle while text-chatting
  13. 2021-10-18
  14.   - added "Enter::" toggle off when pressing chat
  15.   - added "r::", "LAlt::" toggle off when interacting
  16. 2021-10-16
  17.   - added "LWin::" toggle off when tabbing out
  18. 2021-10-10
  19.   - removed #UseHook
  20.   - added extra sprint hotkey "LCtrl::LShift" so that I can sprint with my thumb too
  21.   - "k" has been changed to "toggle := 1", "g" remains as is
  22.  
  23. ***************************************************************************************
  24.  
  25. This script exists to help people with repetitive strain injuries to their hands.
  26. It's a better Reduce Hold on Items, essentially.
  27.  
  28. Each ingame shortcut has its own keybind below, clearly commented.
  29. Change these as fits you. See AHK documentation List of Keys for button names:
  30. https://www.autohotkey.com/docs/KeyList.htm
  31.  
  32. Some of these keybinds will toggle Click-to-Hold on, others will not.
  33. You can customize by changing the "0" and "1" of each "toggle :="
  34.  
  35. Sometimes you may wish to cancel the hold for a shortcut that turns it on.
  36. Both "g" and "NumpadDiv" serve this purpose, with "g" also stowing the item ingame.
  37. These will both deactivate the toggle and also undo an ongoing hold.
  38. Remember that you can customize these to be whatever key you want instead.
  39.  
  40. While holding with one button, you can click the other button without losing that hold.
  41.  
  42.  
  43. ******************************************************
  44. MAKE SURE YOU TURN OFF "Reduce Hold on Items" IN GAME!
  45. ******************************************************
  46.  
  47. ***********
  48. TO INSTALL,
  49. ***********
  50. download and install AutoHotkey from https://www.autohotkey.com/
  51. Then rightclick desktop, create new AHK script, and paste everything into it.
  52. You can then double click the script, every time you play SoT, or add a shortcut
  53. to the script into your Startup folder to have it start with Windows.
  54.  
  55. *****
  56. NOTES
  57. *****
  58. I use ESDF to move instead of WASD, as this gives me additional keys for shortcuts.
  59.  
  60. One problem with using this script is that you can't adjust ingame what keys you want to
  61. navigate barrels with, and these navigation keys should not be keys used in the script,
  62. as they may cause unwanted clicks inside those barrels.
  63.  
  64. For example, "r" opens barrels, but also shifts single items between the inventories.
  65. If i bind "r" in the script, then clicking "r" within a barrel will send a second click,
  66. moving two items instead of one. Not really a major issue, but can be annoying.
  67. */
  68.  
  69. #NoEnv
  70. SendMode Input
  71. SetWorkingDir %A_ScriptDir%
  72.  
  73. /*
  74. **********************************************************************************
  75. */
  76.  
  77. ~LWin:: ;tab out - toggle off in called function
  78.   UndoActiveToggle()
  79. return
  80.  
  81. #If WinActive("ahk_exe SoTGame.exe") ;all keys below only work while SoT is focused
  82.  
  83. ~Ctrl::LShift ;second sprint keybind for thumb on custom keyboards, can still sprint with LShift
  84.  
  85. ~NumpadDiv:: ;unconditional toggle on, active holds not interrupted
  86.   toggle := 1
  87. return
  88.  
  89. ~LAlt:: ;interact - toggle off in called function
  90.   UndoActiveToggle()
  91. return
  92.  
  93. ~Enter:: ;chat - toggle off in called function
  94.   UndoActiveToggle()
  95. return
  96.  
  97. ~g:: ;stow item - toggle off in called function
  98.   UndoActiveToggle()
  99. return
  100.  
  101. ~1:: ;fishing rod
  102.   toggle := 0
  103.   MBStateCheck()
  104. return
  105.  
  106. ~2:: ;shovel
  107.   toggle := 0
  108.   MBStateCheck()
  109. return
  110.  
  111. ~3:: ;instrument
  112.   toggle := 1
  113.   MBStateCheck()
  114. return
  115.  
  116. ~4:: ;compass
  117.   toggle := 1
  118.   MBStateCheck()
  119. return
  120.  
  121. ~5:: ;clock
  122.   toggle := 1
  123.   MBStateCheck()
  124. return
  125.  
  126. ~w:: ;food
  127.   toggle := 0
  128.   MBStateCheck()
  129. return
  130.  
  131. ~t:: ;lantern
  132.   toggle := 1
  133.   MBStateCheck()
  134. return
  135.  
  136. ~a:: ;bucket
  137.   toggle := 0
  138.   MBStateCheck()
  139. return
  140.  
  141. ~z:: ;spy glass
  142.   toggle := 1
  143.   MBStateCheck()
  144. return
  145.  
  146. ~x:: ;plank
  147.   toggle := 0
  148.   MBStateCheck()
  149. return
  150.  
  151. ~v:: ;megaphone
  152.   toggle := 1
  153.   MBStateCheck()
  154. return
  155.  
  156. ~b:: ;tankard
  157.   toggle := 1
  158.   MBStateCheck()
  159. return
  160.  
  161. ~WheelUp:: ;throwables
  162.   toggle := 0
  163.   MBStateCheck()
  164. return
  165.  
  166. ~WheelDown:: ;cannonballs
  167.   toggle := 1
  168.   MBStateCheck()
  169. return
  170.  
  171. ~XButton1:: ;Weapon 1
  172.   toggle := 0
  173.   MBStateCheck()
  174. return
  175.  
  176. ~XButton2:: ;Weapon 2
  177.   toggle := 0
  178.   MBStateCheck()
  179. return
  180.  
  181. /*
  182. ************************************
  183. DO NOT MAKE CHANGES BELOW THIS LINE, unless you perfectly understand this macro.
  184. ************************************
  185. */
  186.  
  187. ;handle toggled behavior for left and right click
  188. #if toggle && WinActive("ahk_exe SoTGame.exe")
  189.   LButton::
  190.     Send, {LButton Down}
  191.     toggle := 0
  192.   return
  193.   RButton::
  194.     Send, {RButton Down}
  195.     toggle := 0
  196.   return
  197. #if
  198.  
  199. ;if left/right mouse button NOT held physically, macro stop holding now.
  200. MBStateCheck() {
  201.   if !GetKeyState("LButton", "P")
  202.     Send, {LButton Up}
  203.   if !GetKeyState("RButton", "P")
  204.     Send, {RButton Up}
  205. return
  206. }
  207.  
  208. ;undo active toggle
  209. UndoActiveToggle() {
  210.   if toggle
  211.     toggle := 0
  212.     Send, {LButton Up}
  213.     Send, {RButton Up}
  214. return
  215. }
Advertisement
Add Comment
Please, Sign In to add comment