OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: ModestNovice on 21 Dec 2008, 18:24:42
-
Hello, Im wondering if there is a way to get a whole number only. As Im using floor and distance. Which works, but the person has to pay it. And it is creating some bad numbers to pay.
Say the distance:
_total = (floor(DCV_TaxiStartPos distance DCV_TaxiEndPos)/1000)*100;
though this can return 4.3 or 4.7 and so on.
is there a way to round to the nearest whole number?
Thanks,
DaChevs
*EDIT* WOoooowwww.... -> command round
(SOLVED)
-
There are floor (round down) ceil (round up) and round (round to nearest). Since you are using a monetary system, you might prefer ceil, since then no journey will be free :P Also, when rounding in any way with maths, it is usual to round at the end, not at any earlier point:
_total = ceil (((DCV_TaxiStartPos distance DCV_TaxiEndPos) / 1000) * 100);
-
righto, thanks Spooner :good: :clap: