Jump to content
MoonBrew

Autoloot list: AutoHotkey script

Recommended Posts

Disclaimer:

 

If too complicated, please skip.

ezgif.com-optimize.gif.dc22e6447900f6a8596e4ea9d1525d2b.gif

Requirements:

  • Install AutoHotkey: https://www.autohotkey.com/.
  • A file with item ids/names that you regularly want on the list.
    • Should be in the same folder
    • Script assumes filename to be "alootids.txt"
    • Each item should be in a single line
    • Use empty line to indicate end of list. Everything after that is ignored.
      • Use the remainder of the file to keep other lists. Only the top list is the one that will be read.

Here is a sample file: alootids.txt

t.thumb.jpg.99a5913473e994108ee972526d638cc7.jpg

 

AutoHotkey is a tool for windows that lets you automate keystrokes and mouse input, much like macros in Excel. It uses scripts that are stored in .ahk files. Copy the code below and save in an .ahk file.

 

filename := "alootids.txt"
delay := 200

~^1::
theFile := FileOpen(filename, "r `n")
if !IsObject(theFile)
	{
		MsgBox Can't open "%filename%" for reading. error code %A_LastError%.
		return
	}
line := theFile.ReadLine()
line := StrReplace(line, "`n")	;`n is newline char
while StrLen(line) > 0
	{
		Send @autoloot item %line%
		Sleep %delay%
		Send {Enter}
		Sleep %delay%
		line := theFile.ReadLine()
		line := StrReplace(line, "`n") 
	}
theFile.Close()
return

~^2::	;Bonus
Send @autoloot clear
Sleep %delay%
Send {Enter}
return

After saving, right click and run the script as administrator (if RO is run as administrator).

 

Usage:

Always switch to RO and make sure your chat box is active for typing. Then press Ctrl+1 to populate your autoloot list.

 

Hotkeys

  • Ctrl+1: Populate your autoloot list.

 

For people who want to play around with the script:

The Hotkey: In the third line before '::' is the hotkey to trigger the actions in the block below it. In this case, its '~^1' which indicated 'Ctrl+1'('^' stands for 'Ctrl" and see the website for what '~' stands for). You can change this to whatever you want and make sure you use correct notation for the keys.

 

Can you find the additional Hotkey that is included in this script?

Delays: The delays are what works for me and might require changes for you. Delays are in milliseconds. Try not to be too fast that the keystrokes are missed.

Tip: You can use an empty text file to test your script.

Edited by MoonBrew
Added sample file.
  • Thanks 1

Share this post


Link to post
Share on other sites

Good script but I think there is already an in game command that works like this. 
Try typing @autoloottype or @aloottype in game to know how it works.

Example: If you just want to loot cards, you can just type @autoloottype +6
 

Share this post


Link to post
Share on other sites
12 minutes ago, Tutting said:

Good script but I think there is already an in game command that works like this. 
Try typing @autoloottype or @aloottype in game to know how it works.

Example: If you just want to loot cards, you can just type @autoloottype +6
 

That seems like good advice. I haven't played around with it.

Share this post


Link to post
Share on other sites

Version 2

This is the version I am using. Its slightly faster and allows entries in alootids.txt to be stored with more freedom. The script uses tabs as delimiter and ignores () and space. It can use both name and ids, whichever is in the last column.

Sample file: alootids.txt

Here is the code:

#NoEnv						; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn						; Enable warnings to assist with detecting common errors.
SendMode Input				; Recommended for new scripts due to its superior speed and reliability.
filename := "alootids.txt"

~^1::
WinGet id, , ahk_exe dreamerro.exe
; ControlGet id, HWND, , , ahk_exe dreamerro.exe
Send % "@autoloot clear"
Sleep 200
Send {Enter}
Sleep 200
Send % "@autoloot rate 10"
Sleep 200
Send {Enter}
Sleep 200
theFile := FileOpen(filename, "r `n")
if !IsObject(theFile)
	{
		MsgBox Can't open "%filename%" for reading. error code %A_LastError%.
		return
	}
line := theFile.ReadLine()
line := StrSplit(line, A_Tab, "() `n", MaxParts := 20)
while StrLen(line[line.MaxIndex()]) > 0
	{
		Send % "@autoloot item " line[line.MaxIndex()]
		Sleep 200
		Send {Enter}
		Sleep 200
		line := theFile.ReadLine()
		line := StrSplit(line, A_Tab, "() `n", MaxParts := 20)
	}
theFile.Close()
return

 

Share this post


Link to post
Share on other sites
Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×