ID:927936
 
Keywords: loop
(See the best response by Ter13.)
ok so im trying to expand my map , and when ever i do i get this


Infinite loop suspected--switching proc to background.
If it is not an infinite loop, either do 'set background=1' or set world.loop_checks=0.


can i get some guidance as to fix this issue
Best response
If a loop runs more than a certain number of times, it it internally flagged as an infinite loop by the runtime. You either need to set the loop processing to background (which means the loop will yield occasionally, allowing other things to process), or you need to disable world.loop_checks in order to prevent the game from switching it to background processing automatically.
can i get a guide line on how to do so ?
world
loop_checks = 0


Put that somewhere in your code.
i thought that was bad and caused the game to crash
Try posting the code for the loop. It's possible you have it set up so that it goes errant.
    tick_lag = 1
loop_checks = 1

proc
Status_Check()

set background = 1

var
Status = "Naruto Revised {Public}"

if(world.status != Status)

world.status = "Naruto Revised {Public}"

spawn(6000)

Status_Check()

New()

..()

spawn(50)

Status_Check()

spawn(600)

if(!Open)

Open = 1

world << "The server is now loaded. Thank you for your patience."


#if DM_VERSION >= 455
//map_format = TOPDOWN_MAP
map_format = TILED_ICON_MAP
icon_size = 32
#endif

var
list
Names=list()
Handles=list()
world
proc
WorldSave()
set background = 1
var/list/O = new
for(var/mob/human/player/X in world)
if(X.client)
O+=X
for(var/mob/M in O)
if(M.client)
M.client.SaveMob()
sleep(100)
sleep(-1)
sleep(100)
spawn()WorldSave()

WSave()
for(var/mob/human/player/O in world)
if(O.client && O.initialized)
spawn()world.SaveMob(O,O.client)

WorldLoop_Status()
set background = 1
//Check()
if (banned_players.len > 0)
save_banned_players()

spawn() bingosort()
sleep(3000)
var/c = 0
for(var/mob/human/player/X in world)
if(X.client)
c++
if(X.ckey in admins)
X << "World status changed"
world.status = "{[sname]}([c]/[maxplayers])"

wcount=c
sleep(500)
spawn()WorldLoop_Status()

Worldloop_VoteClear()
set background = 1 //infinite loops do well to be set as not high priority
spawn()
if(voteclear)
voteclear--
if(voteclear <= 0)
Mute_Elects = new/list()
voteclear = 10

sleep(600)
spawn() Worldloop_VoteClear()


NameCheck(xname)
if(Names.Find(xname))
return 1
else
return 0

New()
..()
spawn(20)
for(var/mob/human/player/npc/X in world)
if(X.questable && !X.onquest&&X.difficulty!="A")
switch(X.locationdisc)
if("Kawa no Kuni")
Town_Kawa+=X
if("Cha no Kuni")
Town_Cha+=X
if("Ishi no Kuni")
Town_Ishi+=X
if("Konoha")
Town_Konoha+=X
if("Suna")
Town_Suna+=X
if("Kiri")
Town_Mist+=X
if("Kumo")
Town_Kumo+=X
if("Iwa")
Town_Iwa+=X
if("Ame")
Town_Ame+=X

spawn() WorldLoop_Status()

spawn() Worldloop_VoteClear()
It would probably be better to use a series of while() loops instead of using spawn() to spawn the same proc.
the whole thing is this only happens when i add more maps . if i remove the maps its just fine
i still dont have a definitive answer here -,-
The issue is the loop, use while() then sleep() inside the while instead of spawn() same_proc().
In response to Shikaphobia
The way you save all mobs is frightening.

proc/saveworld()
while(world)
for(var/client/c)
spawn()
if(c && c.mob && c.initialized?)
c.mob.save()
sleep(100)
none of this has fixed the problem yet -,-
You didn't post which proc it calls for the infinite loop, did you?
i dont know i just posted what i thought, i only get the error when i add the new maps if i uncheck them it goes away but when i have the maps added the loop error happens when hosting .