Go Back   Steam Users' Forums > Steam Game Discussions > D - G > Dragon Age series > Dragon Age 2

Reply
 
Thread Tools Display Modes
Old 03-27-2011, 02:59 PM   #1
xtravar
 
Join Date: Dec 2010
Reputation: 19
Posts: 26
Post Dragon Age II Gamepad script (AutoHotKey)

I made a gamepad script using AutoHotKey. This will allow you to play the PC version of Dragon Age 2 with an Xbox 360 (or similar) controller. All the instructions/button bindings are in da2-gamepad.ahk. Obviously, some creativity has been taken with the bindings since BioWare doesn't want us playing comfortably from the couch.

Download all the *.ahk files here
http://xtravar.org/da2-ahk/

The script attempts to detect your gamepad and which API to use. If it fails, read the instructions and make da2-gamepad.ini from the example.


I do not plan on allowing users to change the bindings, however I'd be glad to explain to someone how to modify the script.

;------------------------------------------------
; INSTALLATION
;-----------------------------------------------
; 1. Install AutoHotkey_L http://www.autohotkey.com/download/
; 2. Run this script (da2-gamepad.ahk)

; ------------------------------------------------
; EXPLANATION OF WHAT'S GOING ON
; ------------------------------------------------
; THIS SCRIPT ASSUMES THE DEFAULT DA2 KEYS
;
; BUTTONS
; Left Trigger - left mouse button / (LB+RB) Quick Save
; Right Trigger - right mouse button / (LB+RB) Quick Load
; Left Bumper - Hold to change button meanings
; Right Bumper - Hold to change button meanings
; Left Thumb Click - Toggle showing names (holds tab)
; Right Thumb Click - Toggle between gamepad mode 0 and 1
; DPad - Switch character
; Left Thumb Axis - Moves character (wqse) - wasd in mode 0
; Right Thumb Axis (Mode 0) - Move the mouse cursor
; Right Thumb Axis (Mode 1) - Look around (right click drag)
; A - Attack/loot nearest
; X, Y, B - Skills 1, 2 3 / (LB) 4, 5, 6 / (RB) 7, 8, 9 / (LB+RB) 0, quick heal, quick mana
; Back - Main Menu (escape) / (LB) Journal / (RB) Map / (LB+RB) Tactics
; Start - Pause / (LB) Character / (RB) Inventory / (LB+RB) Abilities

If you find this useful after all the time I put into it, feel free to buy me a game, say thanks, etc.

--------------------------
Glossary of terms for the technically impaired
--------------------------

Axis (plural axes): An input on a gamepad that ranges between two values. So this is your up/down, left/right for each thumb stick as well as triggers on some gamepads. Gamepads with triggers like this will only register one trigger at a time since holding both triggers gives you the same value as not holding any.

Button: An input on the gamepad that only reports two states - UP and DOWN. Many gamepads will register their triggers as buttons due to the axis limitation mentioned above.

X: Like a graph, X means left/right.

Y: Also like a graph, y means up/down.

XInput: This is a mode supported by gamepads that really only supports what the XBox 360 controllers can do, so it is easy to remain consistent between computers and devices.

WinMM: This is the fallback mode the script uses if XInput is not detected, which means your buttons and axes can be off.

-------------
Settings Overview
-------------
Mode0_RightThumb_InvertX (0 = no/1 = yes): Inverts the left/right axis on the right thumb when in mode 0 (mouse mode) of the script. Mode 1, Y permutations are self-explanatory.

Mode0_RightThumb_SlowSpeed: The speed the mouse will move when within the "slow threshold" of the right thumb stick in mode 0. Mode 1, fast permutations are self-explanatory.

RightThumbSlowThreshold: A value determining where to change between "slow" movement and "fast" movement. Delete this line if you do not want to change from the default.

Delete all the lines which you don't want to change from the default.

[XIX_WinMM] section lets you specify different axes/buttons for what it recognizes as buttons. A value of 0 will not register anything, so if you have analog triggers, TriggerAxis should be above 0 and ButtonLT/ButtonRT should be 0. Vis versa for non-analog triggers.

Last edited by xtravar: 03-31-2011 at 07:29 AM.
xtravar is offline  
Reply With Quote
Old 03-27-2011, 07:45 PM   #2
Lasiurus
 
Join Date: Jun 2010
Reputation: 0
Posts: 59
Hi, I already have autohotkey installed, use it for some games but don't know much about its inner workings, but I'm interested in your solution since, for some reason, my hotkey configuration is resetted to default after launching the game, so maybe this is a good alternative solution. Anyway, there a couple of things I don't understand about your instructions, perhaps you can help me:

what would "AutoHotKey_L with a default script" mean? I installed ahk some time ago and don't remember if I ever configured it like that.

and regarding point 6, I don't seem to have a default AutoHotKey.ahk file.

Thanks.
Lasiurus is offline   Reply With Quote
Old 03-27-2011, 07:50 PM   #3
xtravar
 
Join Date: Dec 2010
Reputation: 19
Posts: 26
You can ignore all that stuff. I just edited it out of my post.

Just install AutoHotKey_L from here: http://www.autohotkey.net/~Lexikos/A..._L_Install.exe

Afterwards you'll be able to run da2-gamepad.ahk directly. The script doesn't kick in until it notices Dragon Age 2 is open.

Last edited by xtravar: 03-27-2011 at 07:53 PM.
xtravar is offline   Reply With Quote
Old 03-27-2011, 07:59 PM   #4
Lasiurus
 
Join Date: Jun 2010
Reputation: 0
Posts: 59
Thanks for the quick response, one question thought, as I said I already have AutoHotKey installed, should install "AutoHotKey_L" anyway? It's asking me to install it in the same directory in which AutoHotKey is installed.
Lasiurus is offline   Reply With Quote
Old 03-27-2011, 08:42 PM   #5
xtravar
 
Join Date: Dec 2010
Reputation: 19
Posts: 26
I believe it's necessary since I use a feature that's only available in the _L version, but I'm not entirely sure. If I were you, yes I would upgrade to the latest AHK_L.
xtravar is offline   Reply With Quote
Old 03-27-2011, 10:21 PM   #6
Lasiurus
 
Join Date: Jun 2010
Reputation: 0
Posts: 59
All right, I installed it downloaded all the files, placed them in a folder on my desk, and launched "da2-gamepad.ahk", it loaded up (I can see it in the traybar), but in game nothing happens. I'm using a Logitech Rumblepad 2. Does the script require an xbox pad specifiacly?
Lasiurus is offline   Reply With Quote
Old 03-28-2011, 06:02 AM   #7
xtravar
 
Join Date: Dec 2010
Reputation: 19
Posts: 26
I'm using the Logitech Coordless F710 - it has a switch on it to switch between DirectInput and XInput. It looks like Logitech doesn't natively support XInput on the Rumblepad 2. You could try out an XInput emulator, or modify the script to use the built-in Joy* hooks instead of XInput. I may be able to look into a compatibility mode this week.

Last edited by xtravar: 03-28-2011 at 06:45 AM.
xtravar is offline   Reply With Quote
Old 03-28-2011, 10:05 AM   #8
Lasiurus
 
Join Date: Jun 2010
Reputation: 0
Posts: 59
Thanks xtravar, if you are willing to make it compatible, I'd rather wait till you do it because I frankly don't feel very confident about my knowledge with scripting in ahk at all

Thanks for even makign this useful script to begin with btw!
Lasiurus is offline   Reply With Quote
Old 03-28-2011, 10:06 AM   #9
zpitt
 
Guest
Posts: n/a
Thanks
  Reply With Quote
Old 03-28-2011, 05:20 PM   #10
xtravar
 
Join Date: Dec 2010
Reputation: 19
Posts: 26
I've updated the script to allow for WinMM input, which should work with all gamepads. You can download the new script files at the link above. xix-complex.ahk was renamed to xix.ahk.

I highly recommend XInput mode if you have a 360 controller or compatible Logitech controller.

If you do find that you need to use WinMM mode, change DA2_GAMEPAD_API in da2-gamepad.ahk from "XINPUT" to "WINMM"

If, once you do this, your buttons are mapped strangely, you can change the WinMM->XInput mapping I made in xix.ahk
This mapping worked with my gamepad.

I probably won't be working on this more unless something is severely wrong.
xtravar is offline   Reply With Quote
Old 03-28-2011, 05:28 PM   #11
Lasiurus
 
Join Date: Jun 2010
Reputation: 0
Posts: 59
xtravar, you're officialy AWESOME. Period.
Lasiurus is offline   Reply With Quote
Old 03-28-2011, 06:23 PM   #12
Lasiurus
 
Join Date: Jun 2010
Reputation: 0
Posts: 59
Ok so I may have stumbled upon a small issue, the script now works well but the mouse pointer behaves strangely. It moves automatically to the left of the screen. Using the stick I can force it downwards or rightwards but not upwards or to the left.


EDIT: I also just noticed that some keys are working as other keys, for example, hitting "back" button toggles highlight instead of opening main menu, the "left bumper" opens the main menu.

Last edited by Lasiurus: 03-28-2011 at 06:26 PM.
Lasiurus is offline   Reply With Quote
Old 03-28-2011, 06:27 PM   #13
xtravar
 
Join Date: Dec 2010
Reputation: 19
Posts: 26
Are you in mouse mode or look mode? You switch by clicking the right stick.

Switching to mouse mode centers the cursor on the screen, and look mode keeps the cursor in the center-bottom of the screen out of your way.
xtravar is offline   Reply With Quote
Old 03-28-2011, 06:33 PM   #14
xtravar
 
Join Date: Dec 2010
Reputation: 19
Posts: 26
Bummer, you're going to have to change the WinMM button mappings in xix.ahk

I imagine it should be easy if you open up the control panel to see which button is which and then change JOY_BUTTON1 to JOY_BUTTON2 or whatnot.
xtravar is offline   Reply With Quote
Old 03-28-2011, 07:22 PM   #15
Lasiurus
 
Join Date: Jun 2010
Reputation: 0
Posts: 59
Well I solved the button exchange problem, indeed some buttons were simply switched. The problem which persists is the mouse pointer moving to the left.

I tried both in mouse mode and look mode, no defference. It keeps going left. Funny thing, even when it hits the edge of the screen, the camera does not move, but if I fiddle with the right analog, the camera starts panning erraticaly to the left.

Also, when in look mode, the y axis is inverted. Weird.

Not sure what may be causing it thought.
Lasiurus is offline   Reply With Quote
Reply

Go Back   Steam Users' Forums > Steam Game Discussions > D - G > Dragon Age series > Dragon Age 2


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -7. The time now is 10:42 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site Content Copyright Valve Corporation 1998-2012, All Rights Reserved.