Diablo 3, toggle R mouse button Topic is solved

Ask gaming related questions (AHK v1.1 and older)
WingbtZ
Posts: 22
Joined: 09 Aug 2018, 04:41

Diablo 3, toggle R mouse button

22 Sep 2018, 06:08

Hello,

So I am trying to make a script for D3, where if I press a button, it holds down Right mouse button, and if I press it again, it releses the button.

I got a script to work on the desktop and other, but it wont work on D3.. Anyone that can help me with this?

Also the script is acting abit weird some times.. If anyone know any inprovements I would be thankful to hear.

Here is my code so far:

Code: Select all

Escape::Reload
RButton::
KeyDown := !KeyDown
If KeyDown
{
SendInput {RButton down}
}
Else
{
SendInput {RButton up}
}
return
User avatar
Onimuru
Posts: 107
Joined: 08 Sep 2018, 18:35
Contact:

Re: Diablo 3, toggle R mouse button  Topic is solved

22 Sep 2018, 07:21

Here are two ways to do it:

1:

Code: Select all

#SingleInstance Force
SendMode Input

Exit

*$RButton::Click, % ((KeyDown := !KeyDown) ? "Down, Right" : "Up, Right")
2:

Code: Select all

#SingleInstance Force
SetTitleMatchMode, 2
CoordMode, Mouse, Screen
SendMode Input

Exit

*$RButton::
	MouseGetPos, x, y
	ControlClick, x%x% y%y%, ahk_class [x], , Right, , % ((KeyDown:= !KeyDown) ? "D" : "U")	;Replace [x] with class from clipboard.
	Return

;Press x while the game is running to copy the class to clipboard: 
x::
	WinGetClass _w, A
	Clipboard := %_w%
	Return
If neither of those work, google "how to make ahk work in games" or something to that effect. I remember reading a post about different techniques to get around games blocking AHK inputs.

EDIT: This is going to be trial and error: https://autohotkey.com/board/topic/1117 ... he-basics/

EDIT2: I found this post (https://autohotkey.com/boards/viewtopic.php?t=17775) that indicates you don't need to do any acrobatics for D3 so the the first example I posted should work.
WingbtZ
Posts: 22
Joined: 09 Aug 2018, 04:41

Re: Diablo 3, toggle R mouse button

22 Sep 2018, 08:24

Thanks alot! Got it working now! Tryd both your script, dident work. Took your advice and googled it.. Turns out that "Run as admin" fixed it.

Code: Select all

Send, Facepalm
Anyway, using this works flawlessly! I doff my hat to thee good sir! :dance:

Code: Select all

Escape::Reload
#SingleInstance force
SendMode Input
Exit
*$RButton::Click, % ((KeyDown := !KeyDown) ? "Down,Right" : "Up,Right")
User avatar
Onimuru
Posts: 107
Joined: 08 Sep 2018, 18:35
Contact:

Re: Diablo 3, toggle R mouse button

22 Sep 2018, 08:52

Add this code to all of your future scripts so that you don't need to worry about admin privileges!

Code: Select all

#SingleInstance Force
SendMode Input

GoSub a_L

Exit	;End auto-exec section

;-------------------------------------------------- LABELS & FUNCTIONS --------------------------------------------------;

a_L:
	GetCommandLine_Variable := DllCall("GetCommandLine", "Str")
	If !(A_IsAdmin || RegExMatch(GetCommandLine_Variable, " /restart(?!\S)"))
	{
		Try
		{
			If A_IsCompiled
				Run *RunAs "%A_ScriptFullPath%" /restart
			Else
				Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%"
		}
		ExitApp
	}
	Return

;-------------------------------------------------- HOTKEYS --------------------------------------------------;
#If WinActive(A_ScriptName)
~^s::
	Sleep 200
	Reload
	Return

Esc::ExitApp
#If

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: Gemos and 69 guests