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 10-22-2001, 03:22 AM
btedji btedji is offline
bryan986
btedji's Avatar
Join Date: Apr 2001
Location: Force 10
Posts: 1,153
btedji is on a distinguished road
Send a message via ICQ to btedji Send a message via AIM to btedji Send a message via Yahoo to btedji
for loops

can you make a for loop that will accept more than one command during each loop?
Reply With Quote
  #2  
Old 10-22-2001, 03:24 AM
KJS KJS is offline
The one, The only -
KJS's Avatar
Join Date: Apr 2001
Location: USA, Minnesota
Posts: 1,012
KJS is on a distinguished road
Send a message via AIM to KJS
Re: for loops

Quote:
Originally posted by btedji
can you make a for loop that will accept more than one command during each loop?
yes do it like this

for(this.i=0;this.i<=10;this.i++{
//coding
}

or something like this

this.i=0;
while(this.i<=10){
this.i++;
//coding
}
__________________
Thanks,
-KJL
Reply With Quote
  #3  
Old 10-22-2001, 09:32 AM
dragoonvenganc dragoonvenganc is offline
Registered User
Join Date: Jul 2001
Location: USA
Posts: 331
dragoonvenganc is on a distinguished road
Send a message via ICQ to dragoonvenganc Send a message via AIM to dragoonvenganc
yep.. but while is a while loop not a for loop..

My favorite nested for loops
__________________
Dragoon Vengance
Owner of Pangea Relics of Time
P2P Rp server
For info or job
Email: [email protected]
aim: dragoonvengnc
Reply With Quote
  #4  
Old 10-22-2001, 09:38 AM
KJS KJS is offline
The one, The only -
KJS's Avatar
Join Date: Apr 2001
Location: USA, Minnesota
Posts: 1,012
KJS is on a distinguished road
Send a message via AIM to KJS
Quote:
Originally posted by dragoonvenganc
yep.. but while is a while loop not a for loop..

My favorite nested for loops
ok first of all I was just giving him an example on how to do that...

and anyways for loops turn into while loops when you execute it (press f6 and look at the coding it turns for loops into while loops)
__________________
Thanks,
-KJL
Reply With Quote
  #5  
Old 10-22-2001, 10:27 AM
dragoonvenganc dragoonvenganc is offline
Registered User
Join Date: Jul 2001
Location: USA
Posts: 331
dragoonvenganc is on a distinguished road
Send a message via ICQ to dragoonvenganc Send a message via AIM to dragoonvenganc
No If i must i will open my computer programming book

I dont care what graal says.

For loops incrment till the number value is unture.

While loops do {} while () that is true..

for has to be a number..

U use For if u know how many times u want to loop and for numbers

While does stuff till it changes

I know u were giveing an example
__________________
Dragoon Vengance
Owner of Pangea Relics of Time
P2P Rp server
For info or job
Email: [email protected]
aim: dragoonvengnc
Reply With Quote
  #6  
Old 10-22-2001, 12:12 PM
KJS KJS is offline
The one, The only -
KJS's Avatar
Join Date: Apr 2001
Location: USA, Minnesota
Posts: 1,012
KJS is on a distinguished road
Send a message via AIM to KJS
Quote:
Originally posted by dragoonvenganc
No If i must i will open my computer programming book

I dont care what graal says.

For loops incrment till the number value is unture.

While loops do {} while () that is true..

for has to be a number..

U use For if u know how many times u want to loop and for numbers

While does stuff till it changes

I know u were giveing an example
ok I already know this...

but I was first giving an example of different ways of doing the loop...

and second graal converts for loops into while loops when it runs the coding...

that is all I said...

i know while loops can have other things then numbers and for loops only can have numbers...

but I was saying that graal converts for loops into while loops when you run it... (well at lest in the debug screen)
__________________
Thanks,
-KJL
Reply With Quote
  #7  
Old 10-22-2001, 08:26 PM
dragoonvenganc dragoonvenganc is offline
Registered User
Join Date: Jul 2001
Location: USA
Posts: 331
dragoonvenganc is on a distinguished road
Send a message via ICQ to dragoonvenganc Send a message via AIM to dragoonvenganc
Ok but i speak in programming terms i do not know how the graal engine does stuff
__________________
Dragoon Vengance
Owner of Pangea Relics of Time
P2P Rp server
For info or job
Email: [email protected]
aim: dragoonvengnc
Reply With Quote
  #8  
Old 10-22-2001, 11:46 PM
PresShinP2P PresShinP2P is offline
Registered User
Join Date: Oct 2001
Location: Screw it
Posts: 84
PresShinP2P is on a distinguished road
Send a message via AIM to PresShinP2P
for (i=1;i>0;i++){
for(j=1;i<0;j++){
}}

ahh yes the nested for loop is a mans best friend
__________________
President Shinra
Reply With Quote
  #9  
Old 10-23-2001, 12:34 AM
JeffTL JeffTL is offline
Registered User
Join Date: Sep 2001
Posts: 374
JeffTL is on a distinguished road
The best loops are made with timeout=.05.


ADDED FOR ESSENTIAL GEEKINESS:

A timeloop in Graal is basically a self-calling function. I'm trying to get a function to call itself in graal...doesn't work too good. So I'll pass function Moby through function ****, having them call each other, whilst having function melville, place that in functions moby and ****...Melville triggered once, lagged a lot...timeout works better. Later I'll try it with a sleep command.
__________________

Last edited by JeffTL; 10-23-2001 at 12:44 AM..
Reply With Quote
  #10  
Old 10-23-2001, 03:14 AM
btedji btedji is offline
bryan986
btedji's Avatar
Join Date: Apr 2001
Location: Force 10
Posts: 1,153
btedji is on a distinguished road
Send a message via ICQ to btedji Send a message via AIM to btedji Send a message via Yahoo to btedji
you do not need timeouts for loops unless you want them to run more than one time in a row, and i dont think doing for(#,#,#){commands;} will work because the for loop looks for ; in the loop and that is where the loop ends and starts with the next number, but i may be mistaken
Reply With Quote
  #11  
Old 10-23-2001, 09:47 AM
dragoonvenganc dragoonvenganc is offline
Registered User
Join Date: Jul 2001
Location: USA
Posts: 331
dragoonvenganc is on a distinguished road
Send a message via ICQ to dragoonvenganc Send a message via AIM to dragoonvenganc
Yes finally some one understands nested for loops.. man.. no one said anything about that..

It is great for doing things like hitobjects and so on.. taking a 17kb weapon and make it to a 2kb weapon is great just becuase of for loops..

and yes for loops are like this

for(variable=#;variable logicstatment #;variable incrementation){Commands}

first part sets the variable to that value when it starts, logic statments are like = < > , I++ adds 1 to i each time

Hey shin wanna job as scripter on server.
Anyone that knows what a nested for is is cool in my book lol
__________________
Dragoon Vengance
Owner of Pangea Relics of Time
P2P Rp server
For info or job
Email: [email protected]
aim: dragoonvengnc
Reply With Quote
  #12  
Old 10-23-2001, 09:53 AM
Falcor Falcor is offline
Darth Cucumber
Falcor's Avatar
Join Date: Mar 2001
Location: At School
Posts: 2,874
Falcor is on a distinguished road
Send a message via ICQ to Falcor Send a message via AIM to Falcor Send a message via MSN to Falcor Send a message via Yahoo to Falcor
i wish we could do stuff like..

for(i=0,j=0;i<100,j<100;i++,j++;) {commands;}
__________________

subliminal message: 1+1=3
Reply With Quote
  #13  
Old 10-23-2001, 10:38 AM
dragoonvenganc dragoonvenganc is offline
Registered User
Join Date: Jul 2001
Location: USA
Posts: 331
dragoonvenganc is on a distinguished road
Send a message via ICQ to dragoonvenganc Send a message via AIM to dragoonvenganc
Why.. j and i would always be =.. what is the use
__________________
Dragoon Vengance
Owner of Pangea Relics of Time
P2P Rp server
For info or job
Email: [email protected]
aim: dragoonvengnc
Reply With Quote
  #14  
Old 10-23-2001, 11:05 AM
KJS KJS is offline
The one, The only -
KJS's Avatar
Join Date: Apr 2001
Location: USA, Minnesota
Posts: 1,012
KJS is on a distinguished road
Send a message via AIM to KJS
Quote:
Originally posted by dragoonvenganc
Why.. j and i would always be =.. what is the use
well I think he is meaning like 1 adds up then the next..
well kinda of like

for(this.x=0;this.x<=10;this.x++) for(this.y=0;this.y<=10;this.y++){
//coding
}

I think he means like so it would run it like that
__________________
Thanks,
-KJL
Reply With Quote
  #15  
Old 10-23-2001, 10:17 PM
dragoonvenganc dragoonvenganc is offline
Registered User
Join Date: Jul 2001
Location: USA
Posts: 331
dragoonvenganc is on a distinguished road
Send a message via ICQ to dragoonvenganc Send a message via AIM to dragoonvenganc
I have not tried can u do 2 conditon staments like x>0&&y<45
if so then u could do that ...just increment y inside the loop
__________________
Dragoon Vengance
Owner of Pangea Relics of Time
P2P Rp server
For info or job
Email: [email protected]
aim: dragoonvengnc
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 04:20 AM.


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