Stop

Suspend the process. The process will automatically be woken up periodically (normally, whenever you open your turn). This can be used to implement things like `Wait one turn':

 Local t = Turn
 Do While t = Turn
   Stop
 Loop

(this is precisely the definition of WaitOneTurn).

Suspended processes will be saved to disk. However, there are restrictions upon the suspended process:

  • not all variables can be saved and restored safely. In particular, user-interface related things normally cannot be saved, thus processes that are in the middle of a user-interface action should not suspend.
  • PCC 1.x has various limits on the size of a suspended process; if the process uses deep recursion or very large code sequences, it will fail to save.

As a general guideline, functions should not suspend, directly or indirectly.

When a script wakes up again, all sorts of things may have been changed (for example, a turn has passed). Local and static variables will be saved with the process (because they belong to it exclusively), shared variables will not be saved.

When the script executes in a context that no longer exists, it will not be restored. PCC will not wake up scripts when you temporarily switched back to an earlier turn.

Since: PCC 1.0.7, PCC2 1.99.10