ID:273455
 
Can someone show me an example? Cause im trying to find an infinite loop i made in my coding because its not allowing me to host my game.. it freezes Dream Daemon
An infinite loop runtime is usually caused by something that, obviously, loops indefinitely. For example:
BEGIN
// code here
goto BEGIN


Usually it's a common misuse of goto that causes most loops. Try to locate the segment of code that the runtime tells you is causing the loop, and tell us.
while(1)

An infinite loop is something which continues without end. The above loop has no means of exiting and will thus frackin explode the program. If a proc keeps calling itself that could also be an infinite loop. Those would be the basic examples.
In response to Duelmaster409 (#1)
The most common misuse of goto is using goto.
In response to Garthor (#3)
Well, yes. A safer alternative to loop things would be to use the universal for(var/i=0,i++,i<=loopval) or while(stuff). I don't see how using goto is necessarily a mistake itself though.
In response to Duelmaster409 (#4)
In response to Duelmaster409 (#1)
I have this loop here:


mob/proc
Year()
loop
sleep(5000)
year+=1
world<<"<font color=yellow><b>Year [year]!</b></font>Server Saving."
src.age+=1
usr<<"<font color=green>You are now age <b>[src.age]</b>"
WorldSave()
src.Teen()
world<<"Server Saved!"
goto loop



but that proc has worked before when hosting.
In response to Yukay Karyuu (#6)
Get rid of goto loop. Replace loop with while(src).
In response to Duelmaster409 (#7)
Can you edit the code i posted with the while(1) inserted cause im a bit confused never hearing while(1) before.
In response to Yukay Karyuu (#8)
While I never said to use while(1), sure, I'll do it for you big boy.

mob/proc
Year()
// loop nothing you twit
while(src)
sleep(5000)
year+=1
world<<"<font color=yellow><b>Year [year]!</b></font>Server Saving."
src.age+=1
usr<<"<font color=green>You are now age <b>[src.age]</b>"
WorldSave()
src.Teen()
world<<"Server Saved!"
// goto NO DON'T
In response to Duelmaster409 (#9)
Idk if this was the problem but i fixed it.. and the Dream Daemon still crashes when i try to host it -__- it freezes and says not responding.
In response to Yukay Karyuu (#10)
Did you by chance set loop_checks=0?
In response to Duelmaster409 (#11)
No.
In response to Duelmaster409 (#11)
Now I did.. and it has the same problem...
In response to Yukay Karyuu (#13)
I never said you SHOULD. I was asking if you did because that would explain the crashing.
In response to Duelmaster409 (#14)
No i dont have that loop check thing.