Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-28-2003, 03:51 AM
osrs osrs is offline
Graalian since 1998
osrs's Avatar
Join Date: Mar 2002
Location: Brazil
Posts: 2,724
osrs is on a distinguished road
Send a message via ICQ to osrs Send a message via AIM to osrs Send a message via MSN to osrs Send a message via Yahoo to osrs
Some Help.

Can anyone explain me 3 commands?
  • return
  • continue
  • break

add some example if possible,thank you.
__________________
"Ability is what you are capable of doing. Motivation determines what you do. Attitude determines how well you do it."
Facebook: facebook.com/raysilvadotnet /
Reply With Quote
  #2  
Old 02-28-2003, 04:05 AM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
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
Reply With Quote
  #3  
Old 02-28-2003, 05:23 AM
osrs osrs is offline
Graalian since 1998
osrs's Avatar
Join Date: Mar 2002
Location: Brazil
Posts: 2,724
osrs is on a distinguished road
Send a message via ICQ to osrs Send a message via AIM to osrs Send a message via MSN to osrs Send a message via Yahoo to osrs
Thank you.
__________________
"Ability is what you are capable of doing. Motivation determines what you do. Attitude determines how well you do it."
Facebook: facebook.com/raysilvadotnet /
Reply With Quote
  #4  
Old 02-28-2003, 10:50 AM
screen_name screen_name is offline
is watching you
Join Date: Mar 2002
Location: The 3rd Dimension
Posts: 2,160
screen_name is on a distinguished road
Send a message via AIM to screen_name Send a message via MSN to screen_name
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....
__________________
[signature]insert here[/signature]
Reply With Quote
  #5  
Old 02-28-2003, 08:42 PM
screen_name screen_name is offline
is watching you
Join Date: Mar 2002
Location: The 3rd Dimension
Posts: 2,160
screen_name is on a distinguished road
Send a message via AIM to screen_name Send a message via MSN to screen_name
Please forgive me, for some reason I was thinking of break instead of continue.
__________________
[signature]insert here[/signature]
Reply With Quote
  #6  
Old 02-28-2003, 11:16 PM
Spark910 Spark910 is offline
Ex-Graal Global
Spark910's Avatar
Join Date: Oct 2001
Location: England
Posts: 10,892
Spark910 has a spectacular aura about
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.
__________________
--Spark911
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 05:31 PM.


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