Code: Select all
#SingleInstance Force
; DSB Note: - Profile specific variables so CHANGE v_DSBDirectory PLEASE
v_DSBTitle=dsb
v_DSBDirectory=C:\Documents and Settings\ian.schofield\Mis documentos\personal\dsb\DSB_0_35\
v_DSBApp=DSB.exe
v_DSBXEnterPos=502
v_DSBYEnterPos=146
; DSB Note: - I have added the following line in my dsb.ini file, autoselecting the dungeon:
; Dungeon=test_dungeon
; DSB Note: - And I have updated dsb.ini to windowed mode (colour picking and mouse coordinates work)
; Windowed = 1
; If the app is already open, close it
IfWinExist, %v_DSBTitle%
{
WinClose, %v_DSBTitle%
}
; Set Working directory - can't find the dsb 'Dungeon' value at startup otherwise
SetWorkingDir, %v_DSBDirectory%
; Run the beast
Run %v_DSBDirectory%%v_DSBApp%, , , newpid
; You need to wait a little for the window to initialize
winwait, ahk_pid %newpid%
; Coords are ALREADY Relative to the window but we're foobarred as we can run in both full or multiwindowed mode
;CoordMode,Pixel,Relative
;CoordMode,Mouse,Relative
; Wait for GREEEEEEN gem on the Enter Button to appear
Loop {
; Snooze a while for the app to load
sleep 1000
; Test if we have the green found in the Enter button yet
PixelGetColor, color, %v_DSBXEnterPos%, %v_DSBYEnterPos%, RGB ; Alt,Slow = Different methods to get a colour
;MouseGetPos, xpos, ypos
;ToolTip XPos is %xpos% and YPos is %ypos% while colour is %color%
If (color=0x00db00)
break
}
; Click Mouse Button to Enter
MouseClick, left, %v_DSBXEnterPos%, %v_DSBYEnterPos%
; End
return