Reputation: 13
I was wondering if there was a way to change the int value of an auto hot key script to a double, as I am trying to "fine tune" how fast the cursor moves and would like to use a decimal value. The only way I can think of being able to input a decimal value would be to use double, but I can not figure out how to change the int values to double(or if it is even possible).
Here is the code and thank you very much in advance!!
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
; NRA
NRA := 1
; NR
~LButton::
while GetKeyState("LButton") & NRA
{
DllCall("mouse_event", uint, 1, int, 0, int, 1, uint, 0, int, 0)
Sleep, 15
DllCall("mouse_event", uint, 1, int, 0, int, 1, uint, 0, int, 0)
Sleep, 5
}
return
; keys
Insert::ExitApp
delete::suspend
I am trying to change the Y values shown below to be decimal points
DllCall("mouse_event", uint, 1, int, 0, int, Y, uint, 0, int, 0)
Sleep, 15
DllCall("mouse_event", uint, 1, int, 0, int, Y, uint, 0, int, 0)
I know that the higher I change that Y value, the faster it goes, but I was hoping to be able to put a value (like 1.5 or 2.7 as an example) into that Y postion.
Upvotes: 1
Views: 655
Reputation: 2682
In AutoHotkey v1.1, floating-point literals are actually just strings and they have a default precision of 6 decimals for floating-point output, which can be changed easily by SetFormat, Format(), Round(), SubStr(), Floor() to display them. Source.
If you are planning on doing larger precision Math you are going to need to use a Math library.
I'm really not sure about your code, since you never specified what variable or showed any math where you needed more precision? Did you leave something out?
Double:
NRA := 1
MsgBox % format("{1:0.15f}", NRA) ; Double precision
Based on your edit:
Unfortunately mouse_event only excepts DWORD and will only accept an Integer value in the range 0 through 4,294,967,295.
Your only choice it seems is to increment by 1 for maximum control.
Upvotes: 0