Well, it seemed to me that some people are very unfamiliar with for.
This is what for actually is:
NPC Code:
i = 0;
while (i<50){
i++;
)
So, for works like this:
Quote:
First, there's the "statement". This is, i = 0;.
for (i=0; ----){}
then, comes a "test".
i<50;
for (i=0;i<50){}
and then an "operation"
for (i=0;i<50;i++){}
So, i becomes zero. As long as i is less then 50, 1 will be added to i, until it becomes 50 (or more).
|
Note: never use
NPC Code:
for (i=0;i<1;i--){}
if you don't want an uber-lagged level with an infinite for-loop.
So, once more:
Quote:
|
I becomes equilevant to zero. As long as i is less then 50, then there's added one to i.
|
Ofcourse, you can add much more to a loop.
NPC Code:
for (i=17;i>0;i--){}
for example. I hope you see all possibilities of i. Here's a nice example:
NPC Code:
if (timeout||playerenters){
this.savex=0;
for (i=1;i<64;i++){
showpoly 2,{this.savex,32,i,32};
this.savex=i;
sleep 0.05;
}
timeout = 0.05;
}