Script to use hotkeys for low and high dpi. Topic is solved

Ask gaming related questions (AHK v1.1 and older)
TheVs

Script to use hotkeys for low and high dpi.  Topic is solved

19 Apr 2018, 12:24

Hi guys,
Hi,i was searching bunch of forums to find the proper software or guide.But my problem is that i simply want to bind hotkeys on the keyboard Logitech g11 to change mouse sensivity while pressing couple of buttons ingame. For example to have in the Game Fortnite My Q , F ,V , T buttons binded so the make my Mouse DPI higher or windows sensivity and 1 , 2 ,3 ,4 buttons turn it lower. or back to default windows sensivity.Can someone suggest a software or a script? I can only bind "G" Keys that are not in use at all for me in the logitech gaming software.
TheVs
Posts: 7
Joined: 21 May 2018, 03:51

Re: Script to use hotkeys for low and high dpi.

21 May 2018, 03:59

Hi,again i saw you responded with an topic,but im a full newbie to this,so can you give like the code in need to put into the Program and hit apply so it will work?Would be really thankful for that.
And yeah no need in use of the dpi function mby windows sensitivity can just be adjusted and thats all like random +2-3 scales in win sensitivity and then back to normal.?
Rangerbot
Posts: 31
Joined: 02 Mar 2018, 10:33

Re: Script to use hotkeys for low and high dpi.

21 May 2018, 10:40

thats not a noob request, that's a lazy request.
TheVs
Posts: 7
Joined: 21 May 2018, 03:51

Re: Script to use hotkeys for low and high dpi.

03 Jun 2018, 18:17

If it would be easy to do,i assume that the guys would already answered me with the coding stuff to put it in the script,right? but its hard,and to learn a scripting language for that is a bit hard if you are clueless in it -_-.Dunno why you assume me being so smart to get it done by myself.
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: Script to use hotkeys for low and high dpi.

04 Jun 2018, 06:14

TheVs wrote:If it would be easy to do,i assume that the guys would already answered me with the coding stuff to put it in the script,right?
I linked you a thread with a complete, pre-made script, that demonstrates exactly what you want. All you had to do was copy and paste and change the hotkeys that activated it.
TheVs
Posts: 7
Joined: 21 May 2018, 03:51

Re: Script to use hotkeys for low and high dpi.

11 Jun 2018, 21:18

I looked now into it,looks good the only thing is how to make several keys to shift up and to shift down?
TheVs
Posts: 7
Joined: 21 May 2018, 03:51

Re: Script to use hotkeys for low and high dpi.

11 Jun 2018, 21:21

And also i have the shift key but now i need also an shift down keybind so i can bind it to 1 , 2 , 3 ,4 buttons?
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: Script to use hotkeys for low and high dpi.

12 Jun 2018, 05:19

This code in sample script 3 controls which button activates the DPI switch:
By default, it is a toggle (F12 to enable, F12 to disable):

Code: Select all

F12::
	MacroOn := !MacroOn
	md.SetState(MacroOn)
	return
If you want qfvt to enable and 1234 to disable, then you want to replace that block of code with this:

Code: Select all

*q::
*f::
*v::
*t::
	md.SetState(1)
	return

*1::
*2::
*3::
*4::
	md.SetState(0)
	return

TheVs
Posts: 7
Joined: 21 May 2018, 03:51

Re: Script to use hotkeys for low and high dpi.

12 Jun 2018, 07:21

EvilC man you are amazing!! Thanks for the help the only struggle i have atm is how to run the scrip i have an ahk file on desktop but when i click on run script im getting errors that the format is not right.
TheVs
Posts: 7
Joined: 21 May 2018, 03:51

Re: Script to use hotkeys for low and high dpi.

12 Jun 2018, 07:24

#SingleInstance force
#include MouseDelta.ahk

; ============= START USER-CONFIGURABLE SECTION =============
ShiftKey := "*q::
*f::
*v::
*t::
md.SetState(1)
return

*1::
*2::
*3::
*4::
md.SetState(0)
return" ;
The key used to shift DPI. Can be any key name from the AHK Key list: https://autohotkey.com/docs/KeyList.htm
ShiftMode := 1 ; 0 for shift-while-held, 1 for toggle
ScaleFactor := 4 ; The amount to multiply movement by when not in Sniper Mode
; ============= END USER-CONFIGURABLE SECTION =============

; Adjust ScaleFactor. If the user wants 2x sensitivity, we only need to send 1x input...
; ... because the user already moved the mouse once, so we only need to send that input 1x more...
; ... to achieve 2x sensitivity
ScaleFactor -= 1
SniperMode := 0
md := new MouseDelta("MouseEvent").Start()

hotkey, % ShiftKey, ShiftPressed
if (!ShiftMode){
hotkey, % ShiftKey " up", ShiftReleased
}
return

ShiftPressed:
if (ShiftMode){
SniperMode := !SniperMode
} else {
SniperMode := 1
}
md.SetState(!SniperMode)
return

ShiftReleased:
if (!ShiftMode){
SniperMode := 0
}
md.SetState(!SniperMode)
return

; Gets called when mouse moves or stops
; x and y are DELTA moves (Amount moved since last message), NOT coordinates.
MouseEvent(MouseID, x := 0, y := 0){
global ScaleFactor

if (MouseID){
x *= ScaleFactor, y *= ScaleFactor
DllCall("mouse_event",uint,1,int, x ,int, y,uint,0,int,0)
}
}
TheVs
Posts: 7
Joined: 21 May 2018, 03:51

Re: Script to use hotkeys for low and high dpi.

12 Jun 2018, 07:24

is this right? replaced the f12 with your code part?

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: ReyAHK and 41 guests