I've been working on a script that utilizes the DLLCall("mouse_event")
here is an example:
DllCall("mouse_event", uint, 1, int, 0, "UInt", 2, uint, 0, int, 0)
Sleep, 2
but the problem is I want to do more precise mouse movements ex: 2.5 down in the y direction but considering the value is an integer I can't do that. Also I can't change the sleep time because I made my program in a stupid way that would make me have to redo a lot of it if I were to change it.
So is there anyway to turn these integer values into a decimal type of value? Or another way to do these types of mouse movements in games?
If so then it would really save me a lot of time, thanks!
DLLCall("mouse_event"): How do I use continous values?
- tomoe_uehara
- Posts: 213
- Joined: 05 Oct 2013, 12:37
- Contact:
Re: DLLCall("mouse_event"): How do I use continous values?
There are absolutely no windows settings which alter the behaviour of the mouse in mouse-aim games.
Windows "Sensitivity" is utterly unrelated, that is to do with mouse cursor.
The ONLY thing that will alter it is changing the DPI setting in the software that came with your mouse. If your mouse did not come with any software, then it is technically impossible to move a fraction of a unit.
Secondly, Sleep 2 IS NOT sleeping for 2ms. Minimum granularity of sleep on a windows system is 10-15ms.
If you are sending a move of 1 @ 10ms and it is twice as much movement as you want, you have 3 options:
1) Halve the sensitivity setting IN GAME (NOT in windows)
2) Double the amount of time you wait between sending updates (ie sleep 20 instead of sleep 10).
This will result in less smooth movement.
3) Halve the DPI setting in the mouse's software (if it exists)
BTW, if you really do want to send moves at a faster rate than 10ms, you need a more accurate timing system such as QPX, or my MicroTimer library
Windows "Sensitivity" is utterly unrelated, that is to do with mouse cursor.
The ONLY thing that will alter it is changing the DPI setting in the software that came with your mouse. If your mouse did not come with any software, then it is technically impossible to move a fraction of a unit.
Secondly, Sleep 2 IS NOT sleeping for 2ms. Minimum granularity of sleep on a windows system is 10-15ms.
If you are sending a move of 1 @ 10ms and it is twice as much movement as you want, you have 3 options:
1) Halve the sensitivity setting IN GAME (NOT in windows)
2) Double the amount of time you wait between sending updates (ie sleep 20 instead of sleep 10).
This will result in less smooth movement.
3) Halve the DPI setting in the mouse's software (if it exists)
BTW, if you really do want to send moves at a faster rate than 10ms, you need a more accurate timing system such as QPX, or my MicroTimer library
Re: DLLCall("mouse_event"): How do I use continous values?
Sorry to keep asking you for help but I tried using your MicroTimer example in the same folder I downloaded MicroTimer in and I couldn't get it to work.evilC wrote: BTW, if you really do want to send moves at a faster rate than 10ms, you need a more accurate timing system such as QPX, or my MicroTimer library
I modified your script to move down 1 unit every 1ms:
Code: Select all
#SingleInstance force
#NoEnv
#include CLR.ahk
/*
Demo Script for MicroTimer
Converts Arrow Keys to mouse cursor, with 1ms move time for the mouse
*/
#SingleInstance force
dllfile := "MicroTimer.dll"
if (!FileExist(dllfile)){
MsgBox DLL Not found
ExitApp
}
asm := CLR_LoadLibrary(dllfile)
; Use CLR to instantiate a class from within the DLL
mt := asm.CreateInstance("MicroTimer")
YState := 0
YTimer := mt.Create(Func("MoveY"), 1)
return
MoveY(){
global YState
DllCall("user32.dll\mouse_event", "UInt", 0x0001, "UInt", 0, "UInt", YState, "UInt", 0, "UPtr", 0)
}
YEvent(evt){
global YState, YTimer
YState := evt
YTimer.SetState(abs(YState))
}
~LButton::
YEvent(1)
return
^Esc::
ExitApp
Re: DLLCall("mouse_event"): How do I use continous values?
Did youever get MicroTimer to do anything?
I have seen issues before where there is some problem loading the DLL or something, but you get no errors, it just does not work.
Would advise trying to get the example MT scripts to run, just to make sure the MT dll is loading for you.
I have seen issues before where there is some problem loading the DLL or something, but you get no errors, it just does not work.
Would advise trying to get the example MT scripts to run, just to make sure the MT dll is loading for you.
Re: DLLCall("mouse_event"): How do I use continous values?
I guess it just does not work because I tried running the example script and I get no errors but it doesn't work. Is there any fixes for it or should I try the other method?evilC wrote:Did youever get MicroTimer to do anything?
I have seen issues before where there is some problem loading the DLL or something, but you get no errors, it just does not work.
Would advise trying to get the example MT scripts to run, just to make sure the MT dll is loading for you.
Re: DLLCall("mouse_event"): How do I use continous values?
Where are you getting the MicroTimer DLL? From the forum thread or downloading from the github releases page?
Who is online
Users browsing this forum: Descolada, Rohwedder, william_ahk and 48 guests