This is a description of what the inheritable file /std/spells.c contains
and how to use it.

In order for you to be able to use this object according to the rules of
the game, you must first read the file /doc/man/general/spells. Do that now.

How to make a spell book
========================

This example exists in coded form in /doc/examples/spells/spell_book.c
The file only set up the spells, the true spell code is in light.c, 
shield.c and energy_blast.c in the same directory.

To get an object that defines spells to work we should first do:

	inherit "/std/spells"; 	/* To inherit the standard spell function. */
	#include <macros.h>	/* Some neat macros :) */
	#include <comb_mag.h>	/* Some easy macros for magic testing. */

Then I make a:

	#define SPELL_DIR "/doc/examples/spells/" /* To be used later. */

The we define the create_spells().

	void
	create_spells()
	{
	    set_name("book");	/* A name for the object. */
	    set_adj("spell");	/* It's a spell book. */

	    set_long("It looks very interesting, perhaps you " +
		"should read it?\n");

	    /* Make it possible to 'read book' or 'read spell book' */
	    add_cmd_item(({"spell book", "book"}), "read", "@@read_book");

	    /* Now we add the spells. */
	    /*	       verb	      function 		    name  */

	    add_spell("light",      "cast_spell", 	"light room");
	    add_spell("shield",	    "cast_spell", 	"magic shield");
	    add_spell("energy_blast", "cast_spell",	"energy blast");
	}

That is all that is needed to set up the spells. Now we must make the function
read_book() so the book can be read.

	int
	read_book()
	{
	    write(break_string("You start to read the old runes in the " +
		"book. You recognize The formulas of three spells:\n", 70) +
		"light room	- to light up the room you are in.\n" +
		"shield		- to get yourself or another person a magic\n" +
		"		  shield as protection.\n" +
		"energy_blast	- to burn your enemy with raw energy.\n");
	    return 1;
	}


Now we have to do the function cast_spell too.

	int
	cast_spell(string str)
	{
	    string spell_file, function_name;

	    seteuid(getuid(this_object())); /* We might have to load a file. */
	    function_name = query_verb();
	    spell_file = SPELL_DIR + query_verb();

	    /* This will call the <function name> in th <spell_file> with the
	       argument str. The actual spell code is there. */
	    return call_other(spell_file, function_name, str);
	}









