Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Some Help. (https://forums.graalonline.com/forums/showthread.php?t=43093)

osrs 02-28-2003 03:51 AM

Some Help.
 
Can anyone explain me 3 commands?
  • return
  • continue
  • break

add some example if possible,thank you. :)

Python523 02-28-2003 04:05 AM

return ends the function that is being called and goes back to the function caller

continue is used in while/for loops, it skips to the next loop if you use it
NPC Code:

for(i=0;i<100;i++){
if(i/2 == int(i/2)) continue;
b++;
}
message #v(b);


should make the text say 50 or 51, not sure which, too lazy to test

break ends a loop
NPC Code:

for(i=0;i>-1;i++){
if(i==100) break;
}


will end the loop when i reaches 100

I'm 99% sure that what I said is accurate, but then again I may be wrong

osrs 02-28-2003 05:23 AM

Thank you.

screen_name 02-28-2003 10:50 AM

Quote:

Originally posted by Python523
NPC Code:

for(i=0;i<100;i++){
if(i/2 == int(i/2)) continue;
b++;
}
message #v(b);


should make the text say 50 or 51, not sure which, too lazy to test

You should really test that. I can even tell, without even running it, that it the message would only be 0.

if (0/2 == int(0/2)) << True

Jagen, Jagen, Jagen....

screen_name 02-28-2003 08:42 PM

Please forgive me, for some reason I was thinking of break instead of continue. :\

Spark910 02-28-2003 11:16 PM

Quote:

Originally posted by screen_name
Please forgive me, for some reason I was thinking of break instead of continue. :\
You are forgiven as you quit for a period of time.


All times are GMT +2. The time now is 04:32 PM.

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