Jump to content


Photo

Diablo III WASD movement


  • Please log in to reply
6 replies to this topic

#1 freeforlife

freeforlife
  • Members
  • 5 posts

Posted 21 May 2012 - 06:19 PM

I found this out there.. Love it! It is not a download, it shows the AHK script.
<!-- m -->http://code.google.c...iablo-iii-wasd/<!-- m -->

Here is the whole code. It's not mine.

/*

													WASD TEST SCRIPT
									Authors: Ever1ast, Jared Sigley aka Yelgis, Soda
											Based on code by Desi Quintans

Description:

This script enables traditional WASD movements for Diablo III. 

The default keys are:
North - W
West - A
South - S
East - D

The keys can be combined to produce a total of 8 directions (4 ordinal and 4 diagonal). The directions are relative to the 
screen, meaning north is moving towards the top of the screen, west is moving towards the left of the screen, and so on.



Use Instructions:
1) Run this script with AutoHotKey
2) Start Diablo III within 60 seconds of step 1
3) If this is your first time running this script remove bindings for the "W" "A" "S" and "D" keys in Diablo III. If any 
	action is bound to one of the keys used for movement by this script the action would be performed in addition to the 
	movement. Keep in mind if you edit this script to use another keyset the same rule applies to those keys
4) Bind the F12 key on your keyboard to the Move action.

NOTE:
If you change the resolution of the game at any point after running the script, you must reload the script for it to function properly

*/



#NoEnv			        		; Prevents bugs caused by environmental variables matching those in the script
#Persistent		       			; Allows the script to stay active and makes it single-instance
#MaxHotkeysPerInterval, 200     ; Safeguard to prevent accidental infinite-looping of events
SendMode Input		        	; Avoids the possible limitations of SendMode Play, increases reliability.
SetWorkingDir %A_ScriptDir%     ; Sets the script's working directory
SetDefaultMouseSpeed, 0         ; For character movement without moving the cursor
SetTitleMatchMode, 3            ; Window title must exactly match Winactive("Diablo III")



; BEGIN config section -- you can change the variables below to your specific needs

mkey = F12			; key bound to Move command in game
y_offset = 10		; distance from character to issue move command on the y-axis (used to calculate the x_offset to maintain aspect ratios)

; END config section

OnExit, Agent_Kill

WinWaitActive, Diablo III, , 60   	; this command waits for Diablo III to be the active window to get window information
if ErrorLevel
{
    MsgBox, Diablo III not started within the allotted time. Please run the script again then start Diablo III
    ExitApp
}
else
{
		Sleep 500
		WinGetPos, win_x, win_y, width, height, A
		x_center := win_x + width / 2
		compensation := (width / height) == (16 / 10) ? 1.063829 : 1.063711
		y_center := win_y + height / 2 / compensation
		offset_mod := y_offset / height
		x_offset := width * offset_mod
				
}

SetTimer, WASD_Handler, 10
return



Agent_Kill:		; kills Agent.exe if it is still running after Diablo and the script close
	if !WinExist("Diablo III")
	{
		Process, Close, Agent.exe 
	}
	ExitApp
return



WASD_Handler:
	if !WinActive("Diablo III") 
	{
		if !WinExist("Diablo III")		; closes the script down if Diablo is no longer running
		{	
			ExitApp
		}
		return
	}


	
	if GetKeyState("Shift", "P")		; this if/loop lets Shift still function as a stand still key
	{
		Loop
		{
			GetKeyState, state, Shift, P
			if state = U  
			break				
		}
	}
	else if GetKeyState("w", "P") || GetKeyState("s", "P") || GetKeyState("a", "P") || GetKeyState("d", "P")
	{
		if GetKeyState("w", "P")
		{
			y_final := y_center - y_offset
		}
		else if GetKeyState("s", "P")
		{
			y_final := y_center + y_offset
		}
		else
		{
			y_final := y_center
		}
				
		if GetKeyState("a", "P")
		{
			x_final := x_center - x_offset
		}
		else if GetKeyState("d", "P")
		{
			x_final := x_center + x_offset
		}
		else
		{
			x_final := x_center
		}
		
		MouseGetPos, x_initial, y_initial
		MouseMove, %x_final%, %y_final%, 0			
		Send {%mkey%}
		MouseMove, %x_initial%, %y_initial%, 0
	}
	
	
	
return


; Copyright (c) 2012, Ever1ast, Jared Sigley aka Yelgis, Soda
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without modification, are permitted provided 
; that the following conditions are met:
;
; - Redistributions of source code must retain the above copyright notice, this list of conditions and the ;   following disclaimer.
; - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the ;   following disclaimer in the documentation and/or other materials provided with the distribution.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED ; WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
; PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 
; ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 
; TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
; HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
; POSSIBILITY OF SUCH DAMAGE.


#2 Desi

Desi
  • Members
  • 161 posts

Posted 19 June 2012 - 11:35 AM

Oh it's so rewarding to see my work being built upon. :3

#3 reallygong

reallygong
  • Members
  • 1 posts

Posted 28 June 2012 - 02:39 AM

Thanks to the creator of this great script and whoever improved it. I have tested it and love the script.

I do have 1 minor request for Demon Hunter. As I need to fire my arrow while moving away from the mobs. I would like to press the shift key once and it's press/on until I press again to release/off. This will have me to fire the arrow without actually clicking on the mob but i can just shoot at the mobs direction.

Anyone can help with the condition loop?

#4 Wingfat

Wingfat
  • Members
  • 932 posts

Posted 09 July 2012 - 09:41 PM

very nicely written.

#5 Relaxe

Relaxe
  • Guests

Posted 18 October 2012 - 03:42 AM

did some changes in the script, try this and check if it solves the demon hunter problem: https://dl.dropbox.c... ... orners.ahk

didnt over checked it yet, but during about 20 min of gameplay, it seems to work fine.
this changes works like this, you dont need to hold shift to shoot, instead, if you are walking with wasd and press left mouse button the scripts sends a shift command for you, this way the demon hunter shoots while you're hold mouse button, walking in between each shoot (if some wasd still being pressed).

o/

#6 joedsmoed

joedsmoed
  • Members
  • 1 posts

Posted 24 November 2012 - 07:37 PM

awesome, I love it. I can actually enjoy diablo 3 now. Now if only this worked with Torchlight 2 as well.

#7 Felewin

Felewin
  • Members
  • 1 posts

Posted 10 February 2013 - 12:11 AM

Hey, this is excellent!
I also play Demon Hunter, think you could reupload the modification for that class? The download is not longer available...

If you can't use Dropbox anymore you could always use ' Ge.tt '.

Thanks!