AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Having trouble turning floating point into integer

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
conchfeld



Joined: 21 Sep 2008
Posts: 16

PostPosted: Thu Sep 25, 2008 5:00 pm    Post subject: Having trouble turning floating point into integer Reply with quote

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
View user's profile Send private message AIM Address
Sivvy



Joined: 21 Jul 2008
Posts: 726
Location: Calgary, AB, Canada

PostPosted: Thu Sep 25, 2008 5:02 pm    Post subject: Reply with quote

Code:
CCADectimer:= 100
settimer, CCADecrease, %CCADectimer%
Back to top
View user's profile Send private message
conchfeld



Joined: 21 Sep 2008
Posts: 16

PostPosted: Thu Sep 25, 2008 5:15 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
conchfeld



Joined: 21 Sep 2008
Posts: 16

PostPosted: Thu Sep 25, 2008 6:03 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
tonne



Joined: 06 Jun 2006
Posts: 1651
Location: Denmark

PostPosted: Thu Sep 25, 2008 7:07 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group