ID:167274
 
What does:

spawn() proc() mean?
Assuming "proc" in that meant a general proc call...

If you used it at the end if a proc, it meant you ended the original proc as you called another one, as opposed to having the called proc be running inside the first one. Good if you don't want loop_checks to cause game shutdown, as happened to me once 'cause I left out the spawn(). You really don't need the spawn() always, just when you're using a recursive proc that runs for a long time.

If you're using it in the middle of a proc, it "splits off" the called proc from the original and has it run at the same time.


--Vito
In response to Vito Stolidus
That is a bunch of bullcrap, it dosen't mean you are ending a proc and calling another. <code>sleep(n)</code> will hold a verb/proc for <code>n</code> entirely. <code>spawn(n)</code> will allow the verb/proc to continue, and when <code>n</code> has passed will execute everything inside of it.
In response to Cheetoz
Ok, so... Which one of you is right?
In response to Speedro
Cheetoz is the correct one.
In response to Speedro
See also:
background setting (proc)
sleep proc

Format:
spawn(Delay=0) Statement

Args:
Delay: The amount of time (in 1/10 seconds) before Statement is executed.

Run Statement after a delay. Statement may be a single statement or a code block enclosed in (optional) braces and indented. If delay is negative, the spawned code is executed before continuing in the main code. If it is zero, the spawned code is scheduled to happen right after other existing events that are immediately pending.
Example:
spawn(30) storm() usr << "Storm clouds are brewing!"

This will display "Storm clouds are brewing!" and then call the storm() proc after 3 seconds.

The important feature of spawn() is that the caller does not have to wait around for the spawned code to finish.


Straight from the DM reference.
In response to Speedro
Actually, you're right, Cheetoz - I assumed that you put that at the end of another proc - if you use sleep() in such a position, it acts as if the original proc is still running, and technically it is. I'll fix it. Sorry for that major overassumption there.


--Vito