proc
loop1()
while(src)
//do something
sleep(10)
loop2()
//do something
spawn(10) loop2()
loop3()
//do something
sleep(10) loop3()
I also had an idea for a loop, which uses a for()
proc/loop4()
for(var/i=1 to 16777216)
//do something
sleep(10)
loop(4)
These are constant loops that will run indefinitely while the player/world exists, so I'm quite curious how big of a performance hit loops can cause. One example would be keep track of the seconds a player has been logged in (for a playtime counter.)
If my understanding of how spawn() works is correct, it's probably the least desirable one out of the bunch, especially if a large amount of players are on a single server each with their individual loop (and other, more important things should be queued first rather than something like the above example.)