SLUDGE

freeze


Syntax:

freeze ();

Purpose:

Freezes execution of the current scene so that tasks (such as loading, saving, inventories or messages) can be performed in the foreground. A new background image is created which is identical to the original background image, but with characters pasted onto it. Characters, screen regions and floors are remembered but not added to the new background image. Any functions (other than the function which ran the freeze command) are paused - unless they have been declared unfreezable.

Return value:

No return value.

Example:

sub init () {
   onLeftMouse (pauseSub);
   loop {
      # Assuming a window size of 640 by 480, and a
      # 'splat.tga' image no bigger than 40 by 40
      addOverlay ('splat.tga', random (600), random (440));
      pause (5);
   }
}

sub pauseSub () {
   freeze ();
   darkBackground ();
   pasteString (CENTRE, 240, "Paused!");
   onLeftMouse (resumeSub);
}

sub resumeSub () {
   unfreeze ();
   onLeftMouse (pauseSub);
}

See also:

Unfreezable Functions

howFrozen

unfreeze