Normally, a script is started (with a keystroke or a command on the console), executes, and terminates. However, you can also define scripts that run for a longer time, Auto Tasks being the most prominent example. Such scripts will normally do something, wait for the next turn, the continue their operation, and so on.

Such an executing script or auto-task is called a process. If you execute the same script twice, that will be two processes.

Every process has its own set of static and local variables. Shared variables will be shared between all processes. Whereas there is no way that one process can access another process' static and local variables, shared variables can be changed while the process waits.

A process waits by executing the Stop command. When you exit PCC, all active processes will be saved to a file (vmX.cc in PCC 1.x, scriptX.cc in PCC2). When you start PCC again, that file will be loaded and all processes continued. They must now check whether they can continue, and execute another Stop if not.

PCC comes with a number of commands predefined that wait for certain conditions to happen, e.g. WaitOneTurn, MoveTo.

Limitations

Processes cannot suspend at every place. For example, if a process currently examining a drawing property calls WaitOneTurn, it will be terminated because PCC cannot uniquely identify a drawing and find it again next turn. In general, everything from your Result file that has an Id can be found again, everything else can not.

Suspending will save the processes' static and local variables. Shared variables will not be saved. You must make sure that the woken-up processes finds them in the state they expect. This also applies to subroutine and function definitions. If the script tries to call a subroutine next turn, you must make sure it is available (e.g. by defining it through your startup script.

Tips

Do not suspend from within functions. Functions can be executed, for example, from search queries, and you wouldn't want your search query to be delayed to next turn.

You can examine and manipulate running processes using the Process Manager.