• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

"Unexpected Syntax Error" using mod

V

Vallyrie

Guest
Hi everybody,

I'm trying to create an on-screen stopwatch, and I have an error coming up when I try to use "mod." Here's the line of code with the error:

s = s mod (rs*60);

All it tells me is that there's an unexpected syntax error. Does anyone know what's wrong?

Thanks in advance!
 

Paskaler

Member
The syntax checker may be highlighting the wrong line(it happens).
Please post all of the surrounding code as well.
 
V

Vallyrie

Guest
The syntax checker may be highlighting the wrong line(it happens).
Please post all of the surrounding code as well.
Here's the create event:

rs = room_speed;

s = 0; //seconds
m = 0; //minutes
h = 0; //hours

Here's the draw event:

s += 1;

s = s mod (rs*60);

if (s == 0) {

m+= 1;

}

if(m > 59){

h+=1;

}

//draw
draw_set_font(font0);
draw_set_color(c_black);

if (m < 10){

draw_text(50, 50, string("0") + string(h) + string(":0") + string(m) + string(":") + string(s/rs));

} else{

draw_text(50, 50, string("0") + string(h) + string(":") + string(m) + string(":") + string(s/rs));

}
 
Top