Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Infinite Loops (https://forums.graalonline.com/forums/showthread.php?t=46976)

GoZelda 08-10-2003 12:50 PM

Infinite Loops
 
Wouln't it be fun to check out how many infinite loops there are? I found... four. The Timeout loop.
if (playerenters||timeout){
//stuff
timeout = 1;
}
the for loop
for (i=1;i>0;i++){
//stuff;
sleep 1;
}
the while loop
while (1=1){
//stuff
sleep 1;
}
the recursive function
loop();
function loop(){
//stuff
sleep 1;
loop();
}
i haven't tested above one =\

Thought 08-10-2003 01:45 PM

I know an infinite loop, it's called Graal, when it's running, of course. :p

GoZelda 08-10-2003 01:51 PM

I know another one, its called vendetta. And another one, it's called PKing.

Destorm 08-10-2003 02:25 PM

Unless i'm mistaken (sorry if I am) sleep isnt a loop but a pause command? Also function(){} isn't a loop either.

protagonist 08-10-2003 02:54 PM

Use several!!!!11

NPC Code:
function loop(){
a=0;
}
if(timeout){
timeout = 1;
a++;
if(a=100){
loop();
}
}




P.S:There are alot of infinite loop possibilities.

GoZelda 08-10-2003 02:58 PM

Destorm, erm... well...

protagonist 08-10-2003 03:00 PM

Quote:

Originally posted by Destorm
Unless i'm mistaken (sorry if I am) sleep isnt a loop but a pause command? Also function(){} isn't a loop either.
Sleep is a command he is using in a loop so that his computer doesn't crash. It basically makes his for loop like a timeout loop. Function he is using to switch back and forth.

Kaimetsu 08-10-2003 03:12 PM

Timeouts aren't really loops per se, nor are recursive functions. And a for loop is basically just an extended while.

Destorm 08-10-2003 03:52 PM

Basically the only real loops are for and while although timeout can be used as a loop

faenix 08-10-2003 04:42 PM

you can have an infinite amount of loops anyway. I don't see the point in this but all you're doing is a creating a conditions that can never be satisfied... and in mathematics there's an unlimited amount of conditions like that.
while (1==1) while (2==2) while (3==3) while (1+1==2) while (1/1==1) while (1^1==1) while (1^3==1)
hehe you get the point

Destorm 08-10-2003 04:44 PM

So who would like to slap him/her in the face first?

faenix 08-10-2003 04:48 PM

Quote:

Originally posted by Destorm
So who would like to slap him/her in the face first?
o.O :(

GoZelda 08-10-2003 05:25 PM

*raised hand*

Dach 08-10-2003 08:22 PM

while (1==1) {
slapeveryone();
sleep .05;
}
function slapeveryone() {
for (i=0;i==i;i++) {
slapposter[i%postercount];
}
slapeveryone();
}

Destorm 08-10-2003 08:51 PM

for (i=0;i=>2;i--) {
slapposter[i%postercount];
}

why all the bells and whistles ;-)

Goboom 08-10-2003 09:56 PM

Quote:

Originally posted by Destorm
for (i=0;i=>2;i--) {
slapposter[i%postercount];
}

why all the bells and whistles ;-)

To add the effect, I mean at a movie you don't just sit down and then the movies done. You have to see the action.
*slaps*
*gets slapped*

wonderboysp2p 08-11-2003 12:36 AM

id be happy with just sound effects...

if (strequals(#a,faenix)){
while(1==1){
play UBERSLAP.wav;
}
}

oops.. forgive that post i just woke up lol

TribulationStaff 08-11-2003 01:55 AM

Or you could do what they did in the earliest viruses, make something calculate Pi or the squareroot of two. Lovely thing, continued fractions.

wonderboysp2p 08-11-2003 01:58 AM

isnt there an npc on 2k1 that calulates pi?

TribulationStaff 08-11-2003 03:23 AM

Quote:

isnt there an npc on 2k1 that calulates pi?
It may approximate it, but you can never actually calculate pi.

GoZelda 08-11-2003 08:09 AM

pi is infinite...

Kaimetsu 08-11-2003 08:12 AM

Quote:

Originally posted by GoZelda
pi is infinite...
No, it just has infinite complexity.

GoZelda 08-11-2003 08:31 AM

That's right. But would 1 divived by 3 have an infinite complxity or IS it infinite?

Dach 08-11-2003 07:37 PM

Quote:

Originally posted by GoZelda
That's right. But would 1 divived by 3 have an infinite complxity or IS it infinite?
to oversimplify, infinite is to big as infinite complexity is to alot of friggen numbers that aren't necessarily big

TribulationStaff 08-11-2003 09:48 PM

Quote:

No, it just has infinite complexity.
Eh, if we really want to get technical we could just say it was irrational.

Kaimetsu 08-12-2003 04:52 AM

Quote:

Originally posted by TribulationStaff
Eh, if we really want to get technical we could just say it was irrational.
True, but that doesn't say quite the same thing. 1/3 is not irrational, but its denary representation has infinite complexity. I'm not even sure if 'infinite complexity' is a mathematical term - I chose it because its meaning is intuitive.

wonderboysp2p 08-12-2003 06:55 AM

was there a purpose to this thread at some point?

Questa 08-12-2003 07:01 AM

Quote:

Originally posted by Dach
while (1==1) {

What if someday 1 doesn't equal 1? Hmm? HMMM?!

Dach 08-12-2003 07:06 AM

Quote:

Originally posted by Questa

What if someday 1 doesn't equal 1? Hmm? HMMM?!

what would we care? when 1 doesn't equal 1 then our heads would explode due to the fact that we now actually have 2 or 3 or any other number of heads...

wonderboysp2p 08-12-2003 07:24 AM

*gasps*
if (created) 1=random(0,450);


:megaeek:

adam 08-12-2003 07:48 AM

*sigh*

I like the square root of 2. It's useful.



Irrational numbers... bah they just.... they just aren't rational!

wonderboysp2p 08-12-2003 07:59 AM

irrational?? nu nu nu!! what if NASA only used rational numbers?? the hubbletelescope would crash into the earth and the sun would explode and 7-11's worldwide would lock their doors


All times are GMT +2. The time now is 12:25 AM.

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