wiztool

obj
OBJECT
	/obj/wiztool


SYNOPSIS
	inherit "/obj/wiztool";


LAST UPDATE
	Thragor, 19-Dec-96, 17:00 MET


DESCRIPTION
	The wiztool is a generic tool you might customize as you like.
	You may create your own commands or use those others have coded.
	It's easy to expand it to new commands and you may give it a
	very personal look.
	The Wiztool can't be used by players! I implemented a
	security-check.

	The following functions are implemented in the wiztool:

	status IsWizTool()
	  Just returns 1 and says, that it is a wiztool.

	mapping SetCommands(mapping m)
	mapping QueryCommands()
	  Returns all added commands which are stored in the
	  wizard-tool (excepthe hardcoded ones). The format is:
	    ([
	      <command>:
	      <command-file>:
	      <command-helpfile>:
            ])
	  <command> is the command, you enter, to execute the
	  function.
	  <command-file> is the file, which will be accessed via
	  call_other(). The function 'main' will be called inside this
	  file with the arguments the player gave to the command as
	  argument to the function.
	  <command-helpfile> will be mored, when someone types 'help
	  <command>'.

	void AddCmd(string cmd,string exec,string help)
	  Add a command. <cmd> is the command, you type to access the
	  function, <exec> is the file, that will be called by
	  call_other(), directing the request to the function 'main'
	  you have to specify. The function 'main' will get the
	  arguments someone typed at the prompt as arguments to the
	  function.

	mapping SetSaveProperties(mapping m)
	mapping QuerySaveProperties()
	  Some commands may need to keep things 'in mind'. They may
	  set these properties (best with SetSave(), see below) which
	  will be stored in the save-file of the wizard, so
	  QuerySaveProperties() and QueryAutoObject() reveals the same
	  information.

	void SetSave(string prop,mixed value,void|status hide)
	  This will set the saveproperty <prop> to the value <value>.
	  If <hide> is not specified, the wizard may query the setting
	  with 'status'. If you don't want this information to be
	  printed, set <hide> to 1.

	mixed QuerySave(string prop)
	  Returns the value of the given saveproperty <prop>.

	void RemoveSave(string prop)
	  Delete the property <prop> (to eliminate redundant
	  informations).

	int print_commands()
	(protected)
	  This is the function, which will print a list of all
	  available commands.

	int print_status()
	(protected)
	  Will print all (not-hidden) saveproperties.

	int print_help(string arg)
	(protected)
	  Will print a helpmsg for a certain command <arg>.

	status secure_check()
	(protected)
	  Will check for a valid interactive user, i. e. the user has
	  to be at least learner and the tool needs to be inside the
	  user.

	int exec_cmd(string arg,void|string cmd)
	  This function is called, when the bare command is directly
	  entered. It evaluates which command to call.
	  <arg> is the normal input a user makes after the command
	  itself. <cmd> is only used, when the command got parsed
	  before, because it had the leading letter of the filename.
	  So if the tool has the filename 'wiztool' and a command
	  'whelp' gets entered, <cmd> will contain 'help' but
	  query_verb() would return 'whelp'.

	int parse_cmd(string arg)
	  If you enter a command with the leading filename-character,
	  this function will be called. It deletes the first character
	  and calls exec_cmd() then.

	void SetAutoObject(mixed value)
	mapping QueryAutoObject()
	  Used to save stored flags.

	void create()
	  Sets a default long- and short-description, the ids
	  'wiztool' and 'tool' and the adjective 'generic'.
	  Then it sets the HelpMsg to the hardcoded commands.
	  Finally the toggle-flag is set to "off" by default.

	void init()
	  Adds all the commands.


INHERITANCE TREE
	obj/wiztool
	  |-obj/lib/number
	  |-obj/lib/string
	  `-std/thing


EXAMPLE
	/players/thragor/item/heap.c


SEE ALSO