Please note that new user registrations disabled at this time.

Autohotkey Script for DS2 for dual mouse buttons

This forum is to be used for all discussions pertaining to any of the titles or expansions within the Dungeon Siege series.
Post Reply
User avatar
cipher_nemo
Posts: 1
Joined: Wed Aug 11, 2010 4:16 pm
Location: State College, PA
Contact:

Autohotkey Script for DS2 for dual mouse buttons

Post by cipher_nemo »

Greetings.

Yes, DS2 and its expansion are quite old as of this posting, but I loaded them up again for a fun trip down memory lane. I did so when I found out I can download a mod to get the camera, field of view, and fog of war work well with triple-monitor resolutions (ie: Matrox TripleHead2Go or ATI Eyefinity).

Image

But the game mechanics annoy me quite a bit with left click to move and right click to attack. I prefer to have it all in one mouse button since I'm playing this game again for fun, not 'pwnage precision'. So I created an Autohotkey script for doing just that: combining the left and right mouse buttons in DS2.

But we need to either hold down or rapidly click the right mouse button to attack repeatedly. So I tweaked my macro. And we don't want to accidentally use the right mouse button on other things. So I tweaked it again and added a delay for when it's held down. It goes something like this:
  1. Left-click sends Left-click for movement
  2. 300ms delay if held down
  3. Spam Right-click every 16ms (approx. once for every 60FPS)
  4. Stop clicking if Left mouse button is released
Here's the code.

Code: Select all

#CommentFlag //

// AutoHotkey Ver:  1.0.48.3
// Author:          cipher_nemo
// Script Function: DS2 Hotkeys

// Recommended for performance and compatibility with future AutoHotkey releases.
#NoEnv
// Recommended for new scripts due to its superior speed and reliability.
SendMode Input

// Limit number of keys sent per interval in ms
#HotkeyInterval 16
#MaxHotkeysPerInterval 1

//suspend script when the number pad's * key is pressed
NumpadMult::
Suspend
Return

//activate when the left mouse button is pressed
$LButton::

SendInput, {LButton}
Sleep, 300
Loop
{
	GetKeyState, LButtonState, LButton, P
	If LButtonState = U
	{
		break
	}
	SendInput, {RButton}
	Sleep, 16
}

Return
Just save this to a text file with the extension ".ahk", install Autohotkey (if you don't already have it), then right click on the .ahk file and choose "compile" to create an executable.

Run this executable to use it. The Numpad multiply key (*) will toggle this script on and off (suspend/resume). Enjoy!
Post Reply