AHK Script for investigating spells


#1

I wrote an AutoHotKey script last night. I love AHK. It gave me control back over my computer. Computers were meant to be our servants, damn it! And now they can be again.

Running UA in windowed mode, I got a screenshot of the spell rune ring, checked the positions of the centre of each rune in a graphics program(*), and plugged in into the top of the following program (these values will vary depending on your screen res):

[code]; Try all spell combos. Assumes:
; - UA is run in windowed mode
; - the spell ring is active
; - you’re not gonna touch keyb or mouse for like 5 hours.

; Rune coords. Screenshot UA window, then get rune coords in a graphics program.
aXPos := [1230, 1350, 1460, 1250, 920, 800, 730, 710, 730, 800, 930 ]
aYPos := [ 280, 370, 620, 970, 960, 870, 752, 620, 480, 370, 280 ]
; Cancel ‘X’ button coords.
cancelX := 1080
cancelY := 250

; Get ready to rumble…
SetDefaultMouseSpeed 0
SendMode Event
MsgBox Click in the Ultima Ascendant window
WinWaitActive Underworld Ascendant

; Once the window’s active, loop all 4-rune combos.
; Note this also tests all 2- and 3-rune combos as you type 2 runes in the process of typing 4.
For i1, x1 in aXPos
{
y1 := aYPos[i1]
For i2, x2 in aXPos
{
y2 := aYPos[i2]
For i3, x3 in aXPos
{
y3 := aYPos[i3]
For i4, x4 in aXPos
{
y4 := aYPos[i4]

    ; Click the 4 runes.        
    MouseMove %x1%, %y1%
    Click %x1%, %y1%
    MouseMove %x2%, %y2%
    Click %x2%, %y2%
    MouseMove %x3%, %y3%
    Click %x3%, %y3%
    MouseMove %x4%, %y4%
    Click %x4%, %y4%
    
    ; Click cancel. Redundant unless one rune click didn't register.
    MouseMove %cancelX%, %cancelY%
    Click %cancelX%, %cancelY%
  }
}

}
}
; Let whoever checks this in the morning know it didn’t crash.
MsgBox Completed successfully[/code]

(* I’m lying, that woulda been the easy way: I wrote a mouse-click logger and clicked each rune in turn, then copy-pasted the numbers from the log. A screenshot would’ve saved me well over an hour… sheesh. Still, now I have a cool mouseclick logger!)