Code:
#NoEnv
#SingleInstance force
SendMode Input
SetWorkingDir %A_ScriptDir%
SetKeyDelay 0
SetMouseDelay 0
SetTitleMatchMode 3
Suspend on
GroupAdd rotmg, Realm of the Mad God
GroupAdd rotmg, Realm of the Mad God - Mozilla Firefox
GroupAdd rotmg, Realm of the Mad God - Google Chrome
GroupAdd rotmg, realmofthemadgod
GroupAdd rotmg, Play Realm of the Mad God
GroupAdd rotmg, Adobe Flash Player 10
GroupAdd rotmg, Adobe Flash Player 11
WinNotActive()
WinActive()
{
Suspend Off
WinWaitNotActive ahk_group rotmg
{
WinNotActive()
}
}
WinNotActive()
{
Suspend on
WinWaitActive ahk_group rotmg
{
WinActive()
}
}
; Switch items in you inv!
1::
slot = 1 ;;;;; CHANGE TO YOUR WEAPON SWAP INVENTORY SLOT
goto swap
2::
slot = 2 ;;;;; CHANGE TO YOUR ABILITY SWAP INVENTORY SLOT
goto swap
swap:
MouseGetPos, mousePosX, mousePosY
WinGetPos, , , winSizeX, winSizeY, A
SysGet, menuHeight, 15
SysGet, vBorderWidth, 32
SysGet, hBorderWidth, 33
SysGet, titleHeight, 4
ImageSearch, imageLocX, imageLocY, %winSizeX%/2, %winSizeY%/2, %winSizeX%, %winSizeY%, img\inv-low.png
if ErrorLevel {
ImageSearch, imageLocX, imageLocY, %winSizeX%/2, %winSizeY%/2, %winSizeX%, %winSizeY%, img\inv-high.png
if ErrorLevel {
ImageSearch, imageLocX, imageLocY, %winSizeX%/2, %winSizeY%/2, %winSizeX%, %winSizeY%, img\inv-med.png
if ErrorLevel {
stretched := true
}
}
}
if(stretched){
posX := 634 + Mod((44 * (slot-1)), (4*44))
posY := 400 + (44 * ((slot-1)//(4)))
multiplierX := ((winSizeX-vBorderWidth)/800)
multiplierY := ((winSizeY-(menuHeight+hBorderWidth+titleHeight))/600)
posX *= multiplierX
posY *= multiplierY
} else {
posX := imageLocX + 30 + Mod((44 * (slot-1)), (4*44)) - vBorderWidth
posY := imageLocY + 50 + (44 * ((slot-1)//(4))) - (menuHeight+hBorderWidth+titleHeight)
}
CoordMode, Mouse, Client
MouseMove, posX, posY
SendEvent {LButton Down}
SendEvent {LButton Up}
SendEvent {LButton Down}
SendEvent {LButton Up}
CoordMode, Mouse, Window
MouseMove, mousePosX, mousePosY
stretched := false
Return