Guest User

ascendancy_keys3.ahk

a guest
Nov 6th, 2025
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.20 KB | None | 0 0
  1. ; autohotkey script for a keyboard interface emulation in Ascendancy
  2. ; tested on Autohotkey v2.0.19
  3. ; should work in DosBOX, fullscreen=true, fullresolution=desktop
  4. ; coordinates (RESX/RESY) might have to be adjusted depending on your resolution
  5.  
  6. ; different speeds to allow the UI to react, increase for debugging
  7. MOUSEFAST := 15
  8. MOUSESLOW := 40
  9.  
  10. SetMouseDelay MOUSESLOW
  11. SendMode "Event"
  12.  
  13. ;---------CONFIG
  14. ; item positions in menu - you will have to change these values as you keep discovering new tech
  15.  
  16. ; these work regardless of tech status (on buildable planet tiles)
  17. FACTORY := 1
  18. AGRIPLOT := 2
  19. LABORATORY := 3
  20.  
  21. ; you need to change these depending on your discoveries
  22. TERRAFORM := 5
  23. METROPLEX := 6
  24. MEGAFACILITY := 7
  25. HYDROPONIFER := 8
  26. CAMPUS := 9
  27.  
  28.  
  29. ;----HOTKEYS
  30. ; Ascendancy already uses "s" to toggle planet squares on/off, so that key is off-limits
  31. ; ^ means CTRL
  32.  
  33. ; buildItem: move cursor to planet tile where you want to build, then hit hotkey (needs free population of course)
  34. a:: buildItem(FACTORY)
  35. d:: buildItem(LABORATORY)
  36. f:: buildItem(AGRIPLOT)
  37. z:: buildItem(MEGAFACILITY)
  38. c:: buildItem(CAMPUS)
  39. v:: buildItem(HYDROPONIFER)
  40.  
  41. ;g:: buildItem(METROPLEX)
  42. w:: buildItem(TERRAFORM)
  43.  
  44. e:: advanceOneDay()
  45. r:: advanceContinually()
  46. ;w:: Send "{Escape}"
  47.  
  48. ; confirm messages ("Go to planet")
  49. space:: toPlanet()
  50.  
  51. q:: automate()
  52.  
  53.  
  54. ;---------FUNCTIONS
  55.  
  56. ; move cursor to percent position, absolute value
  57. absMove(_x,_y) {
  58. LIMX := 500
  59. LIMY := 380
  60.  
  61. RESX := 640
  62. RESY := 480
  63.  
  64. SetMouseDelay MOUSEFAST
  65.  
  66. ; convert percent to abs pixels in desired resolution
  67. x := _x / 100 * RESX
  68. y := _y / 100 * RESY
  69.  
  70. ; move to the very top-left, two instructions to make sure
  71. MouseMove(-1800, -1400, 0, "R")
  72. MouseMove(-350, -350, 0, "R")
  73.  
  74. MouseMove(x, y, 0, "R")
  75. SetMouseDelay MOUSESLOW
  76. }
  77.  
  78. rMove(x,y) {
  79. MouseMove(x, y, 0, "R")
  80. }
  81.  
  82. ;when pointing on tile, move to building menu
  83. toBuildMenu() {
  84. Click
  85. absMove(37,74)
  86. Click
  87. }
  88.  
  89. ;itemNumber is index (begins at 1)
  90. toBuildMenuItem(itemNumber) {
  91. if (itemNumber < 5) {
  92. yPos := 33.5 + (itemNumber - 1) * 15
  93. absMove(50, yPos)
  94. return
  95. }
  96. else ;if more than 4, scroll first
  97. {
  98. ; move to scrollbar-down
  99. absMove(79.5, 71)
  100.  
  101. ; click the necessary number of times
  102. loopCount := itemNumber - 4
  103. if (loopCount == 1)
  104. {
  105. Click
  106. }
  107. else
  108. {
  109. Loop(loopCount)
  110. {
  111. Click
  112. }
  113. }
  114. ; move to the bottom item
  115. absMove(50,81)
  116. }
  117. }
  118.  
  119. ;on planetscreen, cursor on target tile
  120. buildItem(itemIndex) {
  121. if (itemIndex != 0)
  122. {
  123. toBuildMenu()
  124. toBuildMenuItem(itemIndex)
  125. Click
  126. }
  127.  
  128. ;exit the planet screen
  129. ;absMove(0,0)
  130. ;Click
  131. }
  132.  
  133. ; on galaxy map
  134. advanceOneDay() {
  135. absMove(80, 14)
  136. Click
  137. }
  138.  
  139. ; on galaxy map
  140. advanceContinually() {
  141. absMove(93, 14)
  142. Click
  143. }
  144.  
  145. ; also works on "go to research"
  146. toPlanet() {
  147. absMove(27, 74)
  148. Click
  149. }
  150.  
  151. automate() {
  152. Click
  153. absMove(56, 73)
  154. Click
  155. }
  156.  
  157. ;--------------------KEYMAP (set your key bindings here)
  158.  
  159. ; to test/calibrate absMove
  160.  
  161. ; should move to the middle of the screen (50% 50%)
  162. `::
  163. {
  164. absMove(50,50)
  165. }
  166.  
  167. ^`::
  168. {
  169. absMove(25,25)
  170. absMove(50,50)
  171. absMove(75,75)
  172. absMove(90,90)
  173. }
  174.  
  175.  
  176.  
Advertisement
Add Comment
Please, Sign In to add comment