Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   For command? (https://forums.graalonline.com/forums/showthread.php?t=22807)

Will45 02-02-2002 09:30 AM

For command?
 
Could someone teach me this? Thanks.

Lomgren 02-02-2002 09:43 AM

Simple, wel once you have it figured out atleast, heh.

take this;

for (i=0; i<20; i++) {
x = i;
sleep .5;
}

it starts by setting the variable 'i' to 0,
then it does the enclosed script, (setting the npc's x to i, and sleeping so the progress can be watched) then
it adds 1 to i and repeats, it will repeat operating this way untill
the flag, i<20, is not true. Meaning it will stop when the npc's x is 20. There are quite a number of things that the for command can be used for, most common is going through indexes. If you want to know about that, just ask, I may even forget the service charge
:p

Saga2001 02-02-2002 09:51 AM

better example, i think, you can see what happens.
NPC Code:

for (i=0; i<11; i++; ) {
showimg i,@#v(i),5,100+(i*20);
changeimgvis i,4;
}



try it.

zell12 02-02-2002 10:08 AM

your mind is too complex for me

Saga2001 02-02-2002 10:22 AM

Quote:

Originally posted by zell12
your mind is too complex for me
??? lol ???

i saw in the other thread u posted RaWr...u trying to up ur post count? lol :o

zell12 02-02-2002 10:43 AM

yes... Thats why I was posting the nw and new improvments forums...lol

nyghtGT 02-02-2002 11:55 AM

Also:

for (i=0;i<20;i++) {
}

Is basically:

i=0;
while (i<20) {
i++;
}

Why use for ? Cause you can incorporate actions into it ...

for (i=0; i<11; i++; ) {
showimg i,@#v(i),5,100+(i*20);
changeimgvis i,4;
}

So, while, i, is adding to itself it will show text for each
number represented by i ...


All times are GMT +2. The time now is 08:59 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.