View Single Post
  #9  
Old 08-26-2002, 08:25 AM
emortylone emortylone is offline
Registered User
Join Date: Apr 2002
Location: Control-NPC
Posts: 834
emortylone is on a distinguished road
omg! Here is a QUICK explanation of the for command
for consists of THREE parts:
i=0; is generally the first. i is a variable, it can be about any letter. 0 is set to the starting point. you could do i=100 and 100 would be the starting point.
2nd Part) i<allplayerscount; is a generally used one. it says that it will continue if i<allplayerscount
3rd Part) i ++ it means that if the 2nd part is still true, it makes i go up one. I is basically a variable. so here is an example:
NPC Code:

for (i=1;i<playerscount;i++)
{ players[i].x=30;
players[i].y=30;
}


it starts at i=1 (0 is the current player, so it does it for EVERYONE but the current player)
then it will add 1 to i until i equals the playerscount (playerscount = players in THAT level, allplayers is the entire server)
so then it would set every player except the one who started the reaction, to 30 30.
---Shifter
__________________
Quote:
*Stefan: it seems sometimes they hire newbie scripters everywhere x-x
*Stefan: scripters are sometimes like people that draw paintings
*Stefan: all that counts is that it looks nice
Reply With Quote