ID:1508369
 
(See the best response by Pirion.)
Code:
runtime error: Maximum recursion level reached (perhaps there is an infinite loop)
To avoid this safety check, set world.loop_checks=0.
proc name: updateChi (/mob/proc/updateChi)
usr: BayJune (/mob/Start)
src: BayJune (/mob/Start)
call stack:
BayJune (/mob/Start): updateChi()
BayJune (/mob/Start): updateChi()
BayJune (/mob/Start): updateChi()
BayJune (/mob/Start): updateChi()


Problem description: I've set world.loop checks to 0 like it says but this keeps showing up in options and messages when I train. Anyway to fix it?

You have to be very careful with what kind of loops you're using. The fact this is used to "train" makes me think you don't even need a loop and you're doing something wrong.
Best response
loop_checks really doesn't help here.

Maximum recursion refers to the length of nested calls. If you write code that calls itself, then that creates a recursive loop; however there is a limit to how many times one can call itself.

If I use the following code:
mob/proc/DoSomething()
sleep(10)
DoSomething()


DoSomething() will not return until its innermost DoSomething() has returned. Without a conditional stopping this, then it will never return.

You can avoid this by either using a loop rather than calling a function, or spawning the call to the recursive function, allowing the calling function to return without waiting for a response.

Loop:

mob/proc/DoSomething()
set waitfor = 0 //waitfor returns the procedure at the first sleep()...this will allow the orignal caller to continue if you don't need the return value, or have already set it using . =
while(src)
sleep(10)


Spawned caller:

mob/proc/DoSomething()
sleep(10)
spawn(0) DoSomething() //spawn here puts the DoSomething() in the queue, but continues execution of the current procedure.



What I suspect you're doing though is updating a HUD or something such as that. There are more efficient ways of doing this rather than using a loop. Hooks being one way, and using a central place where you change your chi would be another - both not using an infinite loop.
In response to Pirion
I don't think I understand what you mean. I have it here like this:
        updateStats()
usr << output("<font color=white>[usr.Agility]</f>","output6")// Agility
usr << output("<font color=white>[usr.Defense]</f>","output4")// Defense
usr << output("<font color=white>[usr.Power]</f>","output5")// Power
usr << output("<font color=white>[usr.Strength]</f>","output3")// Str
usr << output("<font color=white>[usr.Batps]</f>","output21")// Battlepoints
usr << output("<font color=white>[usr.skillpoints]</f>","output7")// Skillpoints
usr << output("<font color=white>[usr.expmulti]</f>","output22")
usr << output("<font color=white>[usr.Level]</f>","output23")
usr << output("<font color=white>[usr.Exp]/[usr.MExp]</f>","output11")


So would it be like this?:
        updateStats()
usr << output("<font color=white>[usr.Agility]</f>","output6")// Agility
usr << output("<font color=white>[usr.Defense]</f>","output4")// Defense
usr << output("<font color=white>[usr.Power]</f>","output5")// Power
usr << output("<font color=white>[usr.Strength]</f>","output3")// Str
usr << output("<font color=white>[usr.Batps]</f>","output21")// Battlepoints
usr << output("<font color=white>[usr.skillpoints]</f>","output7")// Skillpoints
usr << output("<font color=white>[usr.expmulti]</f>","output22")
usr << output("<font color=white>[usr.Level]</f>","output23")
usr << output("<font color=white>[usr.Exp]/[usr.MExp]</f>","output11")
sleep(10)
spawn(0) usr.updateStats()
That is your updateStats() procedure, we're talking about updateChi(), however the concept is the same.
Ok I did it like that, but, the output where the stats is displayed occasionally blinks.
I just noticed something. Why do you have so many outputs? you should be using labels instead and updating them via winset. Also, why are you updating stats so frequently? stats should only be updated when needed. You should remove that infinite loop and make it so it only updates stats when you actually do something to gain stats..

Since this is a loop you should probably be using src instead of usr
Yea, it only refers back to this every time you level, or login not with everything you do.
You should avoid loops whenever you can, especially loops like those.
Ah, I thought you switched to:
        updateStats()
usr << output("<font color=white>[usr.Agility]</f>","output6")// Agility
usr << output("<font color=white>[usr.Defense]</f>","output4")// Defense
usr << output("<font color=white>[usr.Power]</f>","output5")// Power
usr << output("<font color=white>[usr.Strength]</f>","output3")// Str
usr << output("<font color=white>[usr.Batps]</f>","output21")// Battlepoints
usr << output("<font color=white>[usr.skillpoints]</f>","output7")// Skillpoints
usr << output("<font color=white>[usr.expmulti]</f>","output22")
usr << output("<font color=white>[usr.Level]</f>","output23")
usr << output("<font color=white>[usr.Exp]/[usr.MExp]</f>","output11")
sleep(10)
spawn(0) usr.updateStats()


Alright then, still heed my advice though change the outputs to labels and update them via winset, tell me if that fixes the blinking problem
Also, you should probably post the code to your real problem, the "updateChi" proc
Basically the same thing:
        updateChi()
winset(usr,"default.chibar", "value = [round((usr.Chi/usr.MChi)*100)]")
Paste full code