I've found a little bug. If you try to define a menu like this:
DigMeasure||g(d),ru(t)
it executes only the g flag
To fix this in the mouse.ahk change these lines:
flagexec(flags)
{
global base, sidemenutypeoffset, pauseoffset, fullscreen
full := flags
flags := RegExReplace(flags, "\(.+\)", "")
Loop, parse, flags, `,
{
if (A_LoopField = "t")
{
side := ReadMemory(base+sidemenutypeoffset,"Dwarf Fortress")
if (side <> 0)
{
SendInput, %A_ThisHotkey%
Exit
}
}
if (A_LoopField = "m")
Menu, context, show
if (A_LoopField = "pan")
{
IniWrite, %A_ThisHotkey%, config.ini, pass, dragkey
Run pan.exe
}
if (A_LoopField = "s")
ExitApp
if (A_LoopField = "l")
Run launch.exe
if (A_LoopField = "p")
{
pause := ReadMemory(base+pauseoffset,"Dwarf Fortress")
throw := RegExMatch(full, "p\(.*?\)", match)
match := RegExReplace(match, "p\(|\)", "")
if (match = "p")
WriteMemory(65536,base+pauseoffset,"Dwarf Fortress")
if (match = "u")
WriteMemory(0,base+pauseoffset,"Dwarf Fortress")
if (match = "g")
{
if (pause = "0")
WriteMemory(65536,base+pauseoffset,"Dwarf Fortress")
else
WriteMemory(0,base+pauseoffset,"Dwarf Fortress")
}
}
if (A_LoopField = "g")
{
throw := RegExMatch(full, "g\(.*?\)", match)
match := RegExReplace(match, "g\(|\)", "")
gomenu(match)
}
if (A_LoopField = "k")
{
throw := RegExMatch(full, "k\(.*?\)", match)
match := RegExReplace(match, "k\(|\)", "")
SendInput, %match%
}
if (A_LoopField = "a")
{
throw := RegExMatch(full, "a\(.*?\)", match)
match := RegExReplace(match, "a\(|\)", "")
WinRestore, Dwarf Fortress.exe
ControlSend,, %match%{Enter}, Dwarf Fortress.exe
}
if (A_LoopField = "r")
{
throw := RegExMatch(full, "r\(.*?\)", match)
match := RegExReplace(match, "r\(|\)", "")
Run, %match%
}
if (A_LoopField = "q")
{
IniRead, cursoron, config.ini, pass, cursoron
if (cursoron = "1")
{
IniWrite, 0, config.ini, pass, cursoron
WinClose, cursor.exe
Traytip,, Tracking Disabled!
}
else
{
IniWrite, 1, config.ini, pass, cursoron
Run cursor.exe
Traytip,, Tracking Enabled!
}
}
if (A_LoopField = "dc")
{
if not (A_PriorHotKey = A_ThisHotKey and A_TimeSincePriorHotkey < 500)
{
Exit
}
}
if (A_LoopField = "d")
{
IniWrite, %A_ThisHotkey%, config.ini, pass, dragkey
Run drag.exe
}
if (A_LoopField = "ru")
{
throw := RegExMatch(full, "ru\(.*?\)", match)
match := RegExReplace(match, "ru\(|\)", "")
if (match = "h")
{
IniWrite, %match%, config.ini, pass, flagvar
IniWrite, %A_ThisHotkey%, config.ini, pass, dragkey
Run rule.exe
}
IniRead, ruleon, config.ini, pass, ruleon
if ((match = "t") and (ruleon = "0"))
{
IniWrite, %match%, config.ini, pass, flagvar
IniWrite, 1, config.ini, pass, ruleon
Run rule.exe
}
if ((match = "t") and (ruleon = "1"))
{
WinClose, rule.exe
IniWrite, 0, config.ini, pass, ruleon
}
}
if (A_LoopField = "e")
{
Loop 5
{
SendInput {Escape}
Sleep 10
}
SendInput, {Enter}
}
}
}
with these:
flagexec(flags)
{
global base, sidemenutypeoffset, pauseoffset, fullscreen
Loop, parse, flags, `,
{
full := A_LoopField
flag := RegExReplace(A_LoopField, "\(.+\)", "")
if (flag = "t")
{
side := ReadMemory(base+sidemenutypeoffset,"Dwarf Fortress")
if (side <> 0)
{
SendInput, %A_ThisHotkey%
Exit
}
}
if (flag = "m")
Menu, context, show
if (flag = "pan")
{
IniWrite, %A_ThisHotkey%, config.ini, pass, dragkey
Run pan.exe
}
if (flag = "s")
ExitApp
if (flag = "l")
Run launch.exe
if (flag = "p")
{
pause := ReadMemory(base+pauseoffset,"Dwarf Fortress")
throw := RegExMatch(full, "p\(.*?\)", match)
match := RegExReplace(match, "p\(|\)", "")
if (match = "p")
WriteMemory(65536,base+pauseoffset,"Dwarf Fortress")
if (match = "u")
WriteMemory(0,base+pauseoffset,"Dwarf Fortress")
if (match = "g")
{
if (pause = "0")
WriteMemory(65536,base+pauseoffset,"Dwarf Fortress")
else
WriteMemory(0,base+pauseoffset,"Dwarf Fortress")
}
}
if (flag = "g")
{
throw := RegExMatch(full, "g\(.*?\)", match)
match := RegExReplace(match, "g\(|\)", "")
gomenu(match)
}
if (flag = "k")
{
throw := RegExMatch(full, "k\(.*?\)", match)
match := RegExReplace(match, "k\(|\)", "")
SendInput, %match%
}
if (flag = "a")
{
throw := RegExMatch(full, "a\(.*?\)", match)
match := RegExReplace(match, "a\(|\)", "")
WinRestore, Dwarf Fortress.exe
ControlSend,, %match%{Enter}, Dwarf Fortress.exe
}
if (flag = "r")
{
throw := RegExMatch(full, "r\(.*?\)", match)
match := RegExReplace(match, "r\(|\)", "")
Run, %match%
}
if (flag = "q")
{
IniRead, cursoron, config.ini, pass, cursoron
if (cursoron = "1")
{
IniWrite, 0, config.ini, pass, cursoron
WinClose, cursor.exe
Traytip,, Tracking Disabled!
}
else
{
IniWrite, 1, config.ini, pass, cursoron
Run cursor.exe
Traytip,, Tracking Enabled!
}
}
if (flag = "dc")
{
if not (A_PriorHotKey = A_ThisHotKey and A_TimeSincePriorHotkey < 500)
{
Exit
}
}
if (flag = "d")
{
IniWrite, %A_ThisHotkey%, config.ini, pass, dragkey
Run drag.exe
}
if (flag = "ru")
{
throw := RegExMatch(full, "ru\(.*?\)", match)
match := RegExReplace(match, "ru\(|\)", "")
if (match = "h")
{
IniWrite, %match%, config.ini, pass, flagvar
IniWrite, %A_ThisHotkey%, config.ini, pass, dragkey
Run rule.exe
}
IniRead, ruleon, config.ini, pass, ruleon
if ((match = "t") and (ruleon = "0"))
{
IniWrite, %match%, config.ini, pass, flagvar
IniWrite, 1, config.ini, pass, ruleon
Run rule.exe
}
if ((match = "t") and (ruleon = "1"))
{
WinClose, rule.exe
IniWrite, 0, config.ini, pass, ruleon
}
}
if (flag = "e")
{
Loop 5
{
SendInput {Escape}
Sleep 10
}
SendInput, {Enter}
}
}
}