Div and Int?
Bluevoss
01 Jul 2016, 15:56Need to half a value but don't want fractions. So how can I make this command...
squiffy.set("num",squiffy.get("num")/2);
...return whole numbers (rounded down, I suppose).
squiffy.set("num",squiffy.get("num")/2);
...return whole numbers (rounded down, I suppose).
Dennis Carlyle
01 Jul 2016, 22:42You can use Math.round(x) for the nearest whole number, or round down with Math.floor(x).
--------------------------------
------------------------------------------
--------------------------------
@set health = 91
var H = squiffy.get("health")/2;
squiffy.set("health", Math.round(H));
Your Health is now at {health}.
------------------------------------------
Bluevoss
02 Jul 2016, 04:52That's what I needed. Many thanks!