Hi, forums. How do I find out if a variable is a multiple of 1000? below is what I’ve already tried. Thanks.
if(GainlaserScore == 1000){
LaserScript.GainLaser(10);
LaserScript1.GainLaser(10);
GainlaserScore = 0;
Hi, forums. How do I find out if a variable is a multiple of 1000? below is what I’ve already tried. Thanks.
if(GainlaserScore == 1000){
LaserScript.GainLaser(10);
LaserScript1.GainLaser(10);
GainlaserScore = 0;
The modulo operator is your friend
% is the Modulo operator and a % b returns the remainder of a / b.
In you case the check would be:
if(GainlaserScore % 1000 == 0)
{
//It's a multiple of 1000
}
This way you don’t have to reset the value every time to 0.
It works now. Thanks!