Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; autohotkey script for a keyboard interface emulation in Ascendancy
- ; tested on Autohotkey v2.0.19
- ; should work in DosBOX, fullscreen=true, fullresolution=desktop
- ; coordinates (RESX/RESY) might have to be adjusted depending on your resolution
- ; different speeds to allow the UI to react, increase for debugging
- MOUSEFAST := 15
- MOUSESLOW := 40
- SetMouseDelay MOUSESLOW
- SendMode "Event"
- ;---------CONFIG
- ; item positions in menu - you will have to change these values as you keep discovering new tech
- ; these work regardless of tech status (on buildable planet tiles)
- FACTORY := 1
- AGRIPLOT := 2
- LABORATORY := 3
- ; you need to change these depending on your discoveries
- TERRAFORM := 5
- METROPLEX := 6
- MEGAFACILITY := 7
- HYDROPONIFER := 8
- CAMPUS := 9
- ;----HOTKEYS
- ; Ascendancy already uses "s" to toggle planet squares on/off, so that key is off-limits
- ; ^ means CTRL
- ; buildItem: move cursor to planet tile where you want to build, then hit hotkey (needs free population of course)
- a:: buildItem(FACTORY)
- d:: buildItem(LABORATORY)
- f:: buildItem(AGRIPLOT)
- z:: buildItem(MEGAFACILITY)
- c:: buildItem(CAMPUS)
- v:: buildItem(HYDROPONIFER)
- ;g:: buildItem(METROPLEX)
- w:: buildItem(TERRAFORM)
- e:: advanceOneDay()
- r:: advanceContinually()
- ;w:: Send "{Escape}"
- ; confirm messages ("Go to planet")
- space:: toPlanet()
- q:: automate()
- ;---------FUNCTIONS
- ; move cursor to percent position, absolute value
- absMove(_x,_y) {
- LIMX := 500
- LIMY := 380
- RESX := 640
- RESY := 480
- SetMouseDelay MOUSEFAST
- ; convert percent to abs pixels in desired resolution
- x := _x / 100 * RESX
- y := _y / 100 * RESY
- ; move to the very top-left, two instructions to make sure
- MouseMove(-1800, -1400, 0, "R")
- MouseMove(-350, -350, 0, "R")
- MouseMove(x, y, 0, "R")
- SetMouseDelay MOUSESLOW
- }
- rMove(x,y) {
- MouseMove(x, y, 0, "R")
- }
- ;when pointing on tile, move to building menu
- toBuildMenu() {
- Click
- absMove(37,74)
- Click
- }
- ;itemNumber is index (begins at 1)
- toBuildMenuItem(itemNumber) {
- if (itemNumber < 5) {
- yPos := 33.5 + (itemNumber - 1) * 15
- absMove(50, yPos)
- return
- }
- else ;if more than 4, scroll first
- {
- ; move to scrollbar-down
- absMove(79.5, 71)
- ; click the necessary number of times
- loopCount := itemNumber - 4
- if (loopCount == 1)
- {
- Click
- }
- else
- {
- Loop(loopCount)
- {
- Click
- }
- }
- ; move to the bottom item
- absMove(50,81)
- }
- }
- ;on planetscreen, cursor on target tile
- buildItem(itemIndex) {
- if (itemIndex != 0)
- {
- toBuildMenu()
- toBuildMenuItem(itemIndex)
- Click
- }
- ;exit the planet screen
- ;absMove(0,0)
- ;Click
- }
- ; on galaxy map
- advanceOneDay() {
- absMove(80, 14)
- Click
- }
- ; on galaxy map
- advanceContinually() {
- absMove(93, 14)
- Click
- }
- ; also works on "go to research"
- toPlanet() {
- absMove(27, 74)
- Click
- }
- automate() {
- Click
- absMove(56, 73)
- Click
- }
- ;--------------------KEYMAP (set your key bindings here)
- ; to test/calibrate absMove
- ; should move to the middle of the screen (50% 50%)
- `::
- {
- absMove(50,50)
- }
- ^`::
- {
- absMove(25,25)
- absMove(50,50)
- absMove(75,75)
- absMove(90,90)
- }
Advertisement
Add Comment
Please, Sign In to add comment