[AutoHotKey] AutoLoot

08/14/2009 11:16 Penakle#1
Darkfall AutoLoot for AutoHotKey

Code:
;AutoHotKey script to auto loot at mouse cursor. By Keraam from PhantomRogue's AutoLoot Script
;Press ` to set the initial positions. Then press ` again to auto loot to set positions. 
;Position of bag is saved in AutoLoot.ini. If you need to move the bag then delete this file
;and restart the script to set up loot again.


#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#MaxThreadsPerHotkey 3
destX = ""
destY = ""

IfNotExist, %A_WorkingDir%\AutoLoot.ini
{
	FileAppend,,%A_WorkingDir%\AutoLoot.ini
}

`::  ; ' hotkey (change this hotkey to suit your preferences).
#MaxThreadsPerHotkey 1
IfWinActive, Darkfall Online
{

	if destX = ""
	{
		IniRead, destX, %A_WorkingDir%\AutoLoot.ini, Bag, destX
		IfEqual, destX, ERROR 
		{
			MsgBox,"You have 5 seconds to move cursor to your bag."
			Sleep, 5000
			MouseGetPos, destX, destY
			IniWrite, % destX, %A_WorkingDir%\AutoLoot.ini, Bag, destX
			IniWrite, % destY, %A_WorkingDir%\AutoLoot.ini, Bag, destY	
			MsgBox,"Position has been set."
		}
		else
		{
			IniRead, destY, %A_WorkingDir%\AutoLoot.ini, Bag, destY
		}
	}

	MouseGetPos, curX, curY
	MouseClickDrag, L, curX, curY, destX, destY
	MouseMove, curX, curY
}