Isn't the modulo operator (% in C and C++) implented in AGS? Why? Even if most people will probably never use it but I think it would be useful.
(Sorry for posting so much here the last few hours, but I've just gotten around doing a little advanced stuff with AGS again...)
I think that's just because it's a game environment, not a full programming package. If many people find it useful, I think this can go into the list, as it's not a difficult thing after all. Currently you can do this via:
modx = y - ((y/x)*x);
to get say y mod x .
So that actually works in the engine? This would mean the engine treats the y/x division as a float, which AGS normally doesn't support, right?
No, the reason it works is because it's not treated as a float.
For example, 5 mod 3 (which equals 2).
modx = 5 - ((5 / 3) * 3)
= 5 - (1 * 3)
= 5 - 3
= 2
Ah! Of course! *epiphany*
Thanks!