| View previous topic :: View next topic |
| Author |
Message |
conchfeld
Joined: 21 Sep 2008 Posts: 16
|
Posted: Thu Sep 25, 2008 5:00 pm Post subject: Having trouble turning floating point into integer |
|
|
I'd like to make the period for Settimer a variable in a script, but AHK wont let me.
| Code: |
CCADectimer:= 100
settimer, CCADecrease, CCADectimer | [/code]
<edit> most recent post updated with new question. _________________ Composer
http://www.joshuaevensen.com
Last edited by conchfeld on Thu Sep 25, 2008 6:05 pm; edited 2 times in total |
|
| Back to top |
|
 |
Sivvy
Joined: 21 Jul 2008 Posts: 726 Location: Calgary, AB, Canada
|
Posted: Thu Sep 25, 2008 5:02 pm Post subject: |
|
|
| Code: | CCADectimer:= 100
settimer, CCADecrease, %CCADectimer% |
|
|
| Back to top |
|
 |
conchfeld
Joined: 21 Sep 2008 Posts: 16
|
Posted: Thu Sep 25, 2008 5:15 pm Post subject: |
|
|
Damn, you guys are prompt. This community is really great. Every question I've had has been answered within like a few hours. _________________ Composer
http://www.joshuaevensen.com |
|
| Back to top |
|
 |
conchfeld
Joined: 21 Sep 2008 Posts: 16
|
Posted: Thu Sep 25, 2008 6:03 pm Post subject: |
|
|
Ok another question now though.
| Code: | ZWatch:
if ZWatchEnable = 1
{
getkeystate, LeftZ, JoyZ
if LeftZ between 51 and 97
{
Setformat, float, 0.0
CCWait:= -1((%LeftZ%-100)*4)
}
if LeftZ = 50
{
return
}
}
else
return |
This seems to ALMOST WORK except LeftZ ends up having a lot of decimals in it so, in turn, CCWait ends up being like 95.439859439843458 and settimer doesn't like it.
I tried using setformat to turn the floating point numbers im getting back into straight integers, but I couldn't get it working quite right.
Also what exactly do the %%s mean? Do they just tell a function that doesnt normally expect variables that the value is a variable? _________________ Composer
http://www.joshuaevensen.com |
|
| Back to top |
|
 |
tonne
Joined: 06 Jun 2006 Posts: 1651 Location: Denmark
|
Posted: Thu Sep 25, 2008 7:07 pm Post subject: |
|
|
| Code: | ...
Setformat, float, 0.0
CCWait:= -((LeftZ-100)*4) ; -1( is wrong, and dont use % in expressions
MsgBox %CCWait%
... |
_________________ RegEx Powered Dynamic Hotstrings
COM
AutoHotkey 2 |
|
| Back to top |
|
 |
|