I just found AHK about a week ago, and I decided to make an All-in-One RuneScape Macro. This is only version 0.5, so there are still (hopefully) many features to come.
Current Features
- UseItems (Control+U) - Will automatically use/drop/examine/etc. all items in the specified rows. Useful for burying bones or dropping wood/ores when power mining/woodcutting.
- AutoChat (Control+C) - Will automatically send a specified chat message every 30 seconds. (NOTE: You must enclose characters such as !, ^, &, etc. in curly braces)
- Logout Prevention (Control+L) - Will automatically press the left arrow key every 10 seconds to prevent logging out.
- Configurable Hotkeys
UsageUse the hotkeys described above to start any of the functions, or right-click the tray icon. Press Control+Q to quit. Instructions are displayed when you use any of the functions, and most of it should be pretty self-explanatory. Double-click the tray icon to configure.
Codemain.ahk
Code:
;Directives
if (A_IsCompiled=1) {
#SingleInstance ignore
} else {
#SingleInstance force
}
#MaxThreadsPerHotkey 2
#Persistent
;Set Hotkey variables
HotkeysDisabled=0
UseItemsKey=^U
AutoChatKey=^C
LogoutPreventionKey=^L
QuitKey=^Q
;Set function variables
Chatting=0
ChatMsg=
PreventingLogout=0
bucklex=0
buckley=0
;Set mouse and key speed settings
SetDefaultMouseSpeed, 10
SetKeyDelay, 150
;Startup the macro
GoSub, CreateMenu
GoSub, CreateHotkeys
GoSub, CreateGui
return
;Include all the needed functions
#include menu.ahk
#include gui.ahk
#include functions.ahk
menu.ahk
Code:
CreateMenu:
Menu, TRAY, Tip, RuneScape All-in-One Macro
Menu, TRAY, NoStandard
Menu, TRAY, Icon, *, , 1
Menu, TRAY, Add, Use Items, UseItems
Menu, TRAY, Add, Auto Chat, AutoChat
Menu, TRAY, Add, Logout Prevention, LogoutPrevention
Menu, TRAY, Add
Menu, TRAY, Add, Configure, Configure
Menu, TRAY, Default, Configure
Menu, TRAY, Add, Disable Hotkeys, DisableHotkeys
Menu, TRAY, Add, Quit, Quit
return
gui.ahk
Code:
CreateGui:
Gui, Add, GroupBox, x15 y10 w240 h140 , Hotkeys
Gui, Add, Text, x25 y30 w100 h20, Use Items
Gui, Add, Hotkey, x125 y30 w100 h20 vUseItemsKey, %UseItemsKey%
Gui, Add, Text, x25 y60 w100 h20, Auto Chat
Gui, Add, Hotkey, x125 y60 w100 h20 vAutoChatKey, %AutoChatKey%
Gui, Add, Text, x25 y90 w100 h20, Logout Prevention
Gui, Add, Hotkey, x125 y90 w100 h20 vLogoutPreventionKey, %LogoutPreventionKey%
Gui, Add, Text, x25 y120 w100 h20, Quit
Gui, Add, Hotkey, x125 y120 w100 h20 vQuitKey, %QuitKey%
Gui, Add, Button, x15 y160 w240 h30 gGuiGetBucklePos, Get Inventory Icon Position
Gui, Add, Button, x15 y200 w115 h30 Default gGuiSubmit, Done
Gui, Add, Button, x140 y200 w115 h30 gGuiClose, Cancel
return
GuiGetBucklePos:
Gui, Show, Hide
GoSub, GetBucklePos
Gui, Show
return
GuiSubmit:
Gui, Submit
GoSub, DisableHotkeys
GoSub, CreateHotkeys
return
GuiClose:
GoSub, DisableHotkeys
Gui, Cancel
return
functions.ahk
Code:
GetBucklePos: ;Gets the position of the inventory backpack icon
SplashTextOn, 200, 50, Inventory Icon Position, Please click on the buckle of the inventory backpack icon.
WinMove, Inventory Icon Position, , 0, 0
KeyWait, LButton, D
MouseGetPos, bucklex, buckley
SplashTextOff
return
UseItems: ;Use rows of items
if (bucklex=0 and buckley=0)
GoSub, GetBucklePos
InputBox, StartRow, Use Items, Enter the starting inventory row number., , , , , , , , 1
if ErrorLevel
return
InputBox, EndRow, Use Items, Enter the ending inventory row number., , , , , , , , 7
InputBox, OptionNum, Use Items, Enter the option number of the action to take on the items., , , , , , , , 1
if ErrorLevel
return
;Loop through the rows
CurRow=%StartRow%
SplashTextOn, 200, 50, Use Items, Using items in rows %StartRow% through %EndRow%.
WinMove, Use Items, , 0, 0
Send {Esc}
Loop {
Loop 4 {
xpos=1020+(%A_Index%*4)
if (OptionNum=1)
MouseClick, left, bucklex-75+((A_Index-1)*42), buckley+48+((CurRow-1)*36)
if (OptionNum>1) {
row7adjust=0
if (CurRow=7)
row7adjust=-15
MouseClick, right, 1020+((A_Index-1)*42), 492+((CurRow-1)*36)
MouseClick, left, 1020+((A_Index-1)*42), 492+((CurRow-1)*36)+(OptionNum*15)+row7adjust+10
}
Sleep, 2500
}
EnvAdd, CurRow, 1
if (CurRow>EndRow)
break
}
SplashTextOff
return
AutoChat: ;Automatically sends a chat message every certain number of milliseconds until the user presses Control+C again
if (Chatting=0) {
InputBox, ChatMsg, Auto Chat, Enter the chat message you would like to automatically send., , , , , , , , %ChatMsg%
if ErrorLevel
return
InputBox, ChatTime, Auto Chat, Enter how long you would like to wait between each sent message., , , , , , , , 30000
SplashTextOn, 200, 100, AutoChat, AutoChat will start in 10 seconds. Please click anywhere inside of the RuneScape applet.
WinMove, AutoChat, , 0, 0
Sleep, 10000
SplashTextOn, 175, 50, AutoChat, AutoChat on. Press Control+C again to stop.
WinMove, AutoChat, , 0, 0
Chatting=1
Loop {
if (Chatting=0) {
SplashTextOff
break
}
Send, %ChatMsg%{enter}
Sleep, %ChatTime%
}
} else {
SplashTextOn, 100, 50, AutoChat, Stopping AutoChat...
WinMove, AutoChat, , 0, 0
Chatting=0
}
return
LogoutPrevention:
if (PreventingLogout=0) {
SplashTextOn, 200, 50, Logout Prevention, Logout Prevention will start in 10 seconds.
WinMove, Logout Prevention, , 0, 0
Sleep, 10000
SplashTextOn, 200, 50, Logout Prevention, Logout Prevention on. Press Control+L again to stop.
WinMove, Logout Prevention, , 0, 0
PreventingLogout=1
Loop {
if (PreventingLogout=0) {
SplashTextOff
break
}
Send, {Left}
Sleep, 10000
}
} else {
SplashTextOn, 150, 50, Logout Prevention, Stopping Logout Prevention...
WinMove, Logout Prevention, , 0, 0
PreventingLogout=0
}
return
CreateHotkeys:
Hotkey, %UseItemsKey%, UseItems
Hotkey, %AutoChatKey%, AutoChat
Hotkey, %LogoutPreventionKey%, LogoutPrevention
Hotkey, %QuitKey%, Quit
return
Configure:
if (HotkeysDisabled=0)
GoSub, DisableHotkeys
Gui, Show, h240 w275, RS All-in-One Macro Config
return
DisableHotkeys:
if (HotkeysDisabled=0) {
Suspend, On
Menu, TRAY, Check, Disable Hotkeys
HotkeysDisabled=1
} else {
Suspend, Off
Menu, TRAY, Uncheck, Disable Hotkeys
HotkeysDisabled=0
}
return
Quit:
ExitApp
return
Future Features- Randomize clicks within a few pixels and key presses within a several milliseconds to avoid macro detection.
- Power miner/woodcutter with random event detection
- Automatic Login
- Saving settings for hotkeys to a file loaded at startup
- Highscore lookups (?)
- Auto Air Runner (?) - Runs to the bank, stores noted essence, withdraws unnoted essence, and runs back
- Disable hotkeys when the RuneScape window is not open
Feedback
If anyone has any feedback for new features, or things I could do to improve what I have already, it would be greatly appreciated. I am planning on making a small site for the macro once some more features have been added, which will contain a downloadable executable.
Disclaimer
You use this macro completely at your own risk. I have not extensively tested it for long periods of time, so there may be bugs, and you may be banned if Jagex finds out you are using it. I take no responsibility for any damage to your computer and/or your RuneScape account.
Thanks To
Chris Mallett - For making AutoHotKey, without which this wouldn't be possible.
Rajat - For making SmartGUI Creator, which probably saved me a lot of time making the Configure GUI.