spacer graphic
spacer graphic
Montage of games AGS Logo
spacer graphic

 

spacer graphic
Menu
spacer graphic Home
About
News
Features
Download AGS
spacer graphic Games 
Games main page
Award Winners
Picks of the month
Short games
Medium length games
Full length games
In Production
Hints & Tips
Community
Forums
AGSers World Map
Member websites
Chat
Resources
Tutorials
FAQ
Knowledge Base
Downloads
Links
AGS-related links
* AGS Manual
  * Scripting
    * Maths functions and properties

FloatToInt

int FloatToInt(float value, optional RoundDirection)
Converts the supplied floating point value into an integer.

This function is necessary because implicit conversions in the script are not supported.

RoundDirection can be either eRoundDown (the default), eRoundUp or eRoundNearest, which specifies what direction to round the floating point number in.

Example:

Display("Round down: %d", FloatToInt(10.7));
Display("Round up: %d", FloatToInt(10.7, eRoundUp));
Display("Round nearest: %d", FloatToInt(10.7, eRoundNearest));
displays the integer value of 10.7, rounded in the three different ways.

See Also: IntToFloat


User comments and notes
There are currently no user comments on this page.
The user comment facility is currently disabled.