ID:139428
 
Code:
world
New()
Repopulate()
proc
Repopulate()
sleep(600)
Repop()
for(var/mob/monster/p in world)
if(p.specialmonster==0)
if(p.inbattlemonster==0)
del p
..()
else
..()
else
..()
Repopulate()
..()


Problem description:

This is my repop code. In the game, monsters emerge from portals, and if the player runs away, then a monster normally just wanders around endlessly. My repop code erases monsters that aren't chasing players and respawns the portals. Also the specialmonster var is for monsters I want to stay and not get deleted.

For some reason, it just stops working. I don't know how or why but it just stops looping after an amount of time.

Also, I can't seem to get the interface to stay a certain size. Resize is disabled on the interface. When I run the game locally, it looks fine. When someone else is hosting, the right and bottom edges resize in to the closest thing, making the window smaller and less centered.
You're misunderstanding the parent proc <script>..()</script>. If you're overwriting a proc, the parent proc continues what the proc normally does.

mob/New()
..() // Make a new mob as always
world<<src // output the mob


Also, recursive looping (calling the proc over and over again) isn't a good way of handling looping.

world/proc/Repopulate()
while(1)
sleep(600)
Repop()
for(var/mob/monster/p in world) if(!p.specialmonster&&!p.inbattlemonster) del(p)


The "!" you see in the if() is a NOT. When checking TRUE/FALSE (boolean) variables always use;

if(variable) // equals if(variable==1) or if(variable==TRUE)

if(!variable) // equals if(variable==0) or if(variable=FALSE)


As for your question about the interface, see the Anchor tabs in the window elements properties. It locks the location of the elements and makes scaling possible.
In response to Emasym
Thanks, i'll try this out. :)

The repop works fine now, but I won't be able to tell for sure until it's been up on a server for a while.

And I'm not sure the Anchors will help the problem, but i'll give it a try and see how it turns out next time it's hosted.