Contents | Index | < Browse | Browse >

7.11.  Special Routines

$spec	( $spec	code arg1 arg2	...  argN  )  ->  No  return
	value.	 Performs a special, system-dependent opera-
	tion.  Note that not all  operations  exist  in	 all
	implementations.   Consult your	local ADL documenta-
	tion for information.


	  +------+---------------------------------------+
	  | code |		 function		 |
	  +------+---------------------------------------+
	  |  1	 |   Toggle the	instruction trace flag	 |
	  |  2	 |	     Restart this game		 |
	  |  3	 |    Terminate	execution of this game	 |
	  |  4	 |	Save this game in file arg1	 |
	  |  5	 |    Restore this game	from file arg1	 |
	  |  6	 | Execute the system program named arg1 |
	  |  7	 |  Preserve unknown words in file arg1	 |
	  |  8	 |	Write a	script to file arg1	 |
	  |  9	 |   Print a header line on the	screen	 |
	  |  10	 |	    Set	the right margin	 |
	  +------+---------------------------------------+

	Function 1
	     Toggles the instruction trace  flag.   If	this
	     flag  is  set,  an	 instruction trace and stack
	     dump are printed for every	ADL instruction	exe-
	     cuted (a very messy but informative process).

	Function 2
	     Re-initializes all	 ADL  structures  and  vari-
	     ables,  re-executes START,	and generally starts
	     the game over from	the beginning.

	Function 3
	     Terminates	the game immediately,  no  questions
	     asked.

	Function 4
	     Saves a "core image" of the ADL structures	 and
	     variables sufficient to restore the game to the
	     same position later.

	Function 5
	     Reads a "core image" which	 was  created  by  a
	     previous invocation of Function 4,	thus restor-
	     ing the game to its previous state.

	Function 6
	     Runs  the	program	 arg1  with  arguments	arg2
	     through  argN.   All arguments must be strings,
	     except the	last argument which must be 0.

	Function 7
	     Starts recording those words from the  player's
	     input  which  are	unrecognized by	the run-time
	     parser.  The words	are  appended  to  the	file
	     named  by	arg1.	This recording is stopped if
	     arg1 is 0.

	Function 8
	     Starts recording a	"script" of  all  input	 and
	     output produced during the	subsequent execution
	     of	the game.  The script is  written  into	 the
	     file named	by arg1.  Stops	recording if arg1 is
	     0.

	Function 9
	     Prints  a	line  of   the	 form	"Room	Name
	     Score:  NN	   Moves:  NN"	at  the	 top  of the
	     screen.  It is assumed that arg1 is the name of
	     the  room,	 arg2 is the current score, and	arg3
	     is	the number of turns that have passed.

	Function 10
	     Sets the right margin to arg1.   This  function
	     is	 provided  for	the use	of those games whose
	     messages would  look  better  on  narrower	 (or
	     wider) screens than the default of	80 columns.

	Examples:
		     VERB debug;
		     debug(ACTION) = ($spec 1);

		     VERB restart;
		     restart(ACTION) = ($spec 2);

		     VERB quit;
		     quit(ACTION) = ($spec 3);

		     VERB save;
		     save(ACTION) =
		     LOCAL name;
			     ($say "Save to what filename? ")
			     ($setg name ($read))
			     (IF ($leng	@name) THEN
				     ($spec 4 @name)
			     )
		     ;

		     VERB restore;
		     restore(ACTION) =
		     LOCAL name;
			     ($say "Restore from what filename?	")
			     ($setg name ($read))
			     (IF ($leng	@name) THEN
				     ($spec 5 @name)
			     )
		     ;

		     VERB shell;
		     shell(ACTION) =
			     ($spec 6 "/bin/csh")
		     ;

		     VERB savewords;
		     savewords(ACTION) =
			     ($spec 7 "unknown.wrds")
		     ;

		     VERB script;
		     script(ACTION) =
		     LOCAL name;
			     ($say "Script to what filename? ")
			     ($setg name ($read))
			     (IF ($leng	@name) THEN
				     ($spec 8 @name)
			     )
		     ;

		     Status = ($spec 9 ($name ($loc .ME)) @Score ($turns)) ;

		     START = ($spec 10 60);  { It makes	the text prettier }