Is there a way to Calculate the amount of Pixels your Mouse should Move for different Mouse Sens Settings? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Kierak
Posts: 5
Joined: 22 Jul 2021, 15:00

Is there a way to Calculate the amount of Pixels your Mouse should Move for different Mouse Sens Settings?

25 Jul 2021, 09:46

Hi I created a function that moves your Mouse up and down

Code: Select all

DllCall("mouse_event", "UInt", 0x01, "UInt", 0, "UInt", -X Value)
DllCall("mouse_event", "UInt", 0x01, "UInt", 0, "UInt", X Value)
But when someone has different Mouse settings for Example the DPI and In Game Mouse Sensitivity
The X Values are wrong

My settings are:

DPI: 800

In Game Mouse Sens: 1.7

Those 2 Make the X Value: 950

I made a Formula to calculate the X Value for everyone with different DPI + In Game Mouse Sensitivity:

Code: Select all

Calc:
X =
Status =
DecreaseP := (Sens1 - Sens2)
X1 := (DecreaseP / Sens2) * 100

DecreaseD := (DPI1 - DPI2)
X2 := (DecreaseD / DPI2) * 100
X3 := (X1 + X2) / 2

X := 950 * (X3 / 100)
X := RegExReplace(X, "\.\d*")


Display:
GuiControl, , Results, %X%
I tried testing it out with fake "original" settings but with the right "current" settings.
The Calculator should have given me 950, instead it gave me:

https://i.stack.imgur.com/Rp7Kp.png

Can someone help me?
User avatar
boiler
Posts: 16925
Joined: 21 Dec 2014, 02:44

Re: Is there a way to Calculate the amount of Pixels your Mouse should Move for different Mouse Sens Settings?  Topic is solved

25 Jul 2021, 10:48

The unit of distance specified when calling mouse_event for relative mouse motion is not pixels, it is mickeys. The determination of how many pixels the mouse would move for a given number of mickeys is subject to a user's speed and acceleration settings in Windows:
Microsoft mouse_event documentation wrote:Relative mouse motion is subject to the settings for mouse speed and acceleration level. An end user sets these values using the Mouse application in Control Panel. An application obtains and sets these values with the SystemParametersInfo function.

The in-game setting for mouse sensitivity may put a factor on one or both of those, or it may have its own algorithm that is not necessarily predictable.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 213 guests