Game Development Community

For loops help!

by jerryg7rk3w · in General Discussion · 10/27/2010 (8:13 am) · 2 replies

Hello i keep getting an error every time i run this code:

function EnemyShip::TestMissile(%this)
{
for(%i = 0,%i < 3,%i++)
{
%this.schedule(1000, "firemissile");
}
}

But if i run it without the "for loop" it doesn't give me any errors on debug, for example if i run it like this:

function EnemyShip::TestMissile(%this)
{
%this.schedule(1000, "firemissile");
}

The code above doesn't give me any errors and runs great!
So what am i doing wrong with the for loop operation and how can i fix it so it will run with a for loop?


#1
10/27/2010 (10:10 am)
Improper formatting -- results in error:
for(%i = 0,%i < 3,%i++)
Should be:
for(%i = 0;%i < 3;%i++)
; instead of ,
#2
10/27/2010 (5:07 pm)
Oh wow, thanks alot i fell like such a noob now lol.
I was stuck on it for 2 hours trying to get it to work lol thanks :).