Handy script for when playing Realm

Posts 1–6 of 6 · Page 1 of 1
Handy script for when playing Realm
I have personally used this script for quite a while now. I have based it off of Kalle's Realmscript, but it is almost completely different after having edited it to make it more useful for myself.

You need to have AutoHotKey for this script to be able to run.

It includes an equipment swapper (slot one with weapon slot, slot two with ability slot).
And it also has a semi-autolooter (It will search for pots (Excluding Life and Mana) at the loot area and pick them up if you have inventory space whenever you right-click).
It will not drink pots since it emulates a mouse move from the bag/vault to the mp/hp pot area.

Before you can use it you'll have to specify the location of the image files I send with the script.

Code:
#NoEnv
#SingleInstance force
SendMode Input
SetWorkingDir %A_ScriptDir%

SetKeyDelay 0
SetMouseDelay 0
SetTitleMatchMode 2
SetNumLockState, On

GroupAdd rotmg, Realm of the Mad God
GroupAdd rotmg, realmofthemadgod
GroupAdd rotmg, AGCLoader
GroupAdd rotmg, Play Realm of the Mad God
GroupAdd rotmg, SwiffOutRunner
GroupAdd rotmg, Adobe Flash Player 10
GroupAdd rotmg, Adobe Flash Player 11
GroupAdd rotmg, fla
GroupAdd rotmg, ROTMG Custom

Suspend on

WinNotActive()

WinActive()
{
	Suspend Off
	WinWaitNotActive ahk_group rotmg
	{
		WinNotActive()
	}
}
WinNotActive()
{
	Suspend on
	WinWaitActive ahk_group rotmg
	{
		WinActive()
	}
}

+^R::
Reload
Sleep 1000 ; If successful, the reload will close this instance during the Sleep, so the line below will never be reached.
MsgBox, 4,, The script could not be reloaded. Would you like to open it for editing?
IfMsgBox, Yes, Edit
return


;This will reset your window size to the default rotmg window size when you type '/win' when the rotmg window is active.
:*:/win::
	{
		WinMove, ahk_group rotmg, , 275, 40, 816, 659
		;WinMove, ahk_group rotmg, , 275, 40, 1616, 916
		;WinMove, ahk_group rotmg, , 275, 40
	}
Send {Enter}
return

; sends rclick when ctrl+rclick is sent to get the flash context menu.
^RButton::
Click right
Return

; scroll the chat log with the default in game keybinds.
+WheelUp::Send {PgUp}
+WheelDown::Send {PgDn}


;pauses the game when you press `
`::
clipboard = /pause
goto ek

; you can enter anything after the '=', this will set and send that message

Numpad1::
clipboard = 
goto ek

Numpad2::
clipboard = 
goto ek

Numpad3::
clipboard = 
goto ek

Numpad4::
Return

Numpad5::
Return

Numpad6::
clipboard = 
goto ek

Numpad9::
clipboard = 
goto ek

f5::
clipboard = 
goto ek

; types '/nexustutorial' on ctrl+t
^t::
clipboard = /nexustutorial
goto ek

; convert /tp to /teleport in the game chat
:*:/tp::
clipboard = /teleport
Blockinput, on
Send ^a
Send ^v
Send {space}
Blockinput, off
Return

; set a teleport target
^n::InputBox, tptarget, Teleport target, Please enter a person to teleport to:

; teleport to the target set with ctrl+n using ctrl+f
^f::
clipboard = /teleport %tptarget%
goto ek

;Switch Weapon from slot 1. You can change which button is used (I use a Razer Naga, therefore these numpad numbers are easiest to use for me)
Numpad7::
BlockInput, On
SendMode Event
MouseGetPos, mousePosX, mousePosY
winGetPos, , , winSizeX, winSizeY, A
ImageSearch, imageLocX, imageLocY, 0, 0, %winSizeX%, %winSizeY%, im\searchimage.png
imageLocX += 0
imageLocY -= 0
Xinc = 643
Yinc = 450

{
	MouseMove, imageLocX + Xinc, imageLocY + Yinc, 50
	SendEvent {LButton Down}
	MouseMove, imageLocX + Xinc + 3, imageLocY + Yinc + 3
	Sleep 60
	MouseMove, ImageLocX + Xinc, imageLocY + Yinc - 78, 50
	SendEvent {LButton Up}
	Sleep 1
	Xinc += 50
}

MouseMove, mousePosX, mousePosY
BlockInput, Off
Return

;Switch Ability from slot 2.
Numpad8::
Blockinput, On
SendMode Event
MouseGetPos, mousePosX, mousePosY
winGetPos, , , winSizeX, winSizeY, A
ImageSearch, imageLocX, imageLocY, 0, 0, %winSizeX%, %winSizeY%, img\searchimage.png
imageLocX += 0
imageLocY -= 0
Xinc = 686
Yinc = 450

{
	MouseMove, imageLocX + Xinc, imageLocY + Yinc, 50
	SendEvent {LButton Down}
	MouseMove, imageLocX + Xinc + 3, imageLocY + Yinc + 3
	Sleep 60
	MouseMove, ImageLocX + Xinc, imageLocY + Yinc - 78, 50
	SendEvent {LButton Up}
	Sleep 1
	Xinc += 50
}

MouseMove, mousePosX, mousePosY
Blockinput, Off
Return

; sends clipboard to the chat using the enter key
ek:
Blockinput, on
Send {Enter}
Send ^v
Send {Enter}
Blockinput, off
Return


;///////////////////////////////////////////////////////////////////////////////////////////////////////////////////

;AutoLooterScript

;You will need to put the file location of the pot references into the scripts yourself eg: 'C:\Users\Name\Pictures\Rotmg referal\HPPot.bmp' just make sure it is the correct path and it'll loot all pots 

save for Mana and Life, whenever you press your RButton.


RButton::
{

ImageSearch, FoundX, FoundY, 620, 550, 800, 640, *w0 *h-1 C:\Users\YOURNAME\LOCATION\MPPot.bmp
if ErrorLevel = 1
{
	Blockinput, on
	Blockinput, off
}
else if ErrorLevel = 0
	Goto MoveMouse

ImageSearch, FoundX, FoundY, 620, 550, 800, 640, *w0 *h-1 C:\Users\YOURNAME\LOCATION\HPPot.bmp
if ErrorLevel = 1
{
	Blockinput, on
	Blockinput, off
}
else if ErrorLevel = 0
	Goto MoveMouse

ImageSearch, FoundX, FoundY, 620, 550, 800, 640, *w0 *h-1 C:\Users\YOURNAME\LOCATION\DefPot.bmp
if ErrorLevel = 1
{
	Blockinput, on
	Blockinput, off
}
else if ErrorLevel = 0
	Goto MoveMouse

ImageSearch, FoundX, FoundY, 620, 550, 800, 640, *w0 *h-1 C:\Users\YOURNAME\LOCATION\AttPot.bmp
if ErrorLevel = 1
{
	Blockinput, on
	Blockinput, off
}
else if ErrorLevel = 0
	Goto MoveMouse

ImageSearch, FoundX, FoundY, 620, 550, 800, 640, *w0 *h-1 C:\Users\YOURNAME\LOCATION\WisPot.bmp
if ErrorLevel = 1
{
	Blockinput, on
	Blockinput, off
}
else if ErrorLevel = 0
	Goto MoveMouse

ImageSearch, FoundX, FoundY, 620, 550, 800, 640, *w0 *h-1 C:\Users\YOURNAME\LOCATION\DexPot.bmp
if ErrorLevel = 1
{
	Blockinput, on
	Blockinput, off
}
else if ErrorLevel = 0
	Goto MoveMouse

ImageSearch, FoundX, FoundY, 620, 550, 800, 640, *w0 *h-1 C:\Users\YOURNAME\LOCATION\SpdPot.bmp
if ErrorLevel = 1
{
	Blockinput, on
	Blockinput, off
}
else if ErrorLevel = 0
	Goto MoveMouse

ImageSearch, FoundX, FoundY, 620, 550, 800, 640, *w0 *h-1 C:\Users\YOURNAME\LOCATION\VitPot.bmp
if ErrorLevel = 1
{
	Blockinput, on
	Blockinput, off
}
else if ErrorLevel = 0
	Goto MoveMouse

return
}

MoveMouse:
{
BlockInput, On
SendMode Event
MouseGetPos, mousePosX, mousePosY
winGetPos, , , winSizeX, winSizeY, A
ImageSearch, imageLocX, imageLocY, 0, 0, %winSizeX%, %winSizeY%, img\searchimage.png
imageLocX += 0
imageLocY -= 0
Xinc = FoundX
Yinc = FoundY

{
	MouseMove, imageLocX + FoundX, imageLocY + FoundY, 50
	SendEvent {LButton Down}
	MouseMove, imageLocX + FoundX + 3, imageLocY + FoundY + 3
	Sleep 60
	MouseMove, 700, 530, 50
	SendEvent {LButton Up}
	Sleep 1
}

MouseMove, mousePosX, mousePosY
return
}
Image file scans
Scan1:
Scan2:

I actually did the scans, but I am not allowed to post any links myself, therefore they are missing.
Rotmg referal.rar4 KB · 21 downloads Clean
Pretty much the same as Realmscript with the autolooter and some stuff removed.
Problem with this line
Code:
;You will need to put the file location of the pot references into the scripts yourself eg: 'C:\Users\Name\Pictures\Rotmg referal\HPPot.bmp' just make sure it is the correct path and it'll loot all pots 

save for Mana and Life, whenever you press your RButton.
So you gave us the code, but what do we do with it? How do we start it or make it work?
Quote Originally Posted by HappyMan20 View Post
So you gave us the code, but what do we do with it? How do we start it or make it work?
Install AutoHotKey and save everything in the code block area to a new file called anything.ahk, then double click that file and it should start.

Quote Originally Posted by sacredmike View Post
Problem with this line
Code:
;You will need to put the file location of the pot references into the scripts yourself eg: 'C:\Users\Name\Pictures\Rotmg referal\HPPot.bmp' just make sure it is the correct path and it'll loot all pots 

save for Mana and Life, whenever you press your RButton.
Remove it. Line wrap fucked up the comment.
help
I dont know, what i must do to work, please record video
Posts 1–6 of 6 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us