Can I round up numbers to turn a double into an int?
GC2
31 Oct 2019, 23:38After calculation, HP sometimes end up with decimals. How do I round them up or down?
mrangel
01 Nov 2019, 02:21You use the functions Ceiling()
(rounds up), Floor()
(rounds down), or Round()
(rounds to the closest int).

DarkLizerd
01 Nov 2019, 02:22Quest offers four functions that will round your double to an integer. Note, however, that the type will still be double. Rounding a double with the value 4.56 will give a double with the value 4.00.
Ceiling - (Round up)
Floor - (Round down)
Round
Truncate
To display a double to, say, three decimal places, multiple it by 1000, then round it, then divide by 1000.
msg("The objective is " + (Round(distance * 1000)/1000) + " km away.")
To convert to an integer type you will need to use cast (note that there are no quotes around int).
my_int = cast(4.56, int)
rahul221sharmaa
05 Nov 2019, 09:54mx player for pc ok here