Largely rewrote and refactored the help system.

The help entry database structure has changed! You have to resync or purge
your database or your will get problems!

New features:
* Help entry access now fully controlled by evennia permissions
* Categories for each help entry
* All entries are created dynamically, with a See also: footer calculated
  after the current state of the database.
* Indexes and topic list calculated on the fly (alphabetically/after category)
* Added auto-help help entries for all default commands.
* Only shows commands _actually implemented_ - MUX help db moved into 'MUX' category
  which is not shown by default.
* More powerful auto-help markup - supports categories and permissions (and inheritance).
* Global on/off switch for auto-help, when entering production
* Auto_help_override switch for selectively activating auto-help when developing
  new commands (like the old system).
* Refactored State help system; no more risk of overwriting global help entries.
* State help now defers to main help db when no match found; makes system more transparent.
* State help entries also support categories/permissions (state categories are not
  used much though).

Other updates:
* Added more commands to the batch processor
* Many bug-fixes.

/Griatch
This commit is contained in:
Griatch 2009-10-14 18:15:15 +00:00
parent 46e2cd3ecb
commit 8074617285
27 changed files with 1995 additions and 1072 deletions

View file

@ -14,11 +14,10 @@ recognized.
Next enter the mud and give the command
> entermenu
Note that the help entries added to the state system with the auto_help flag are NOT
part of the normal help database, they are stored with the state and only accessible
from inside it (unless you also set the 'global_help' flag in the add_command(), in
which case it is also added to the global help system). If you want to describe the
state itself in more detail you should add that to the main help index manually.
Note that the help entries related to this little menu are not part of the normal
help database, they are stored with the state and only accessible
from inside it. If you want to describe the state itself in more detail you
should add a help entry about it to the main help index manually.
To further test the state system, try the command
> enterstate
@ -58,10 +57,13 @@ def cmd_entermenu(command):
#show the menu.
s = """
Welcome to the Demo menu!
In this demo all you can do is select one of the two options so it changes colour.
This is just intended to show off the possibility of the state system. More
interesting things should of course happen in a real menu. Use @exit to
leave the menu."""
In this small demo all you can do is select one of
the two options so it changes colour.
This is just intended to show off the
possibilities of the state system. More
interesting things should of course happen
in a real menu.
Use @exit to leave the menu."""
source_object.emit_to(s)
source_object.execute_cmd('menu')
@ -88,7 +90,7 @@ def menu_cmd_menu(command):
"""
menu
Clears the options and redraws the menu.
<<TOPIC:autohelp>>
[[autohelp]]
This is an extra topic to test the auto-help functionality. The state-help
system supports nested ('related') topics just like the normal help index does.
"""
@ -117,19 +119,15 @@ def print_menu(source_obj,choice=None):
#Add the 'entry' command to the normal command table
GLOBAL_CMD_TABLE.add_command("entermenu", cmd_entermenu)
#create the state.
#create the state.
GLOBAL_STATE_TABLE.add_state(STATENAME,exit_command=True)
#Add the menu commands to the state table by tying them to the 'menu' state. It is
#important that the name of the state matches what we set the player-object to in
#the 'entry' command. Since auto_help is on, we will have help entries for all commands
#while in the menu.
GLOBAL_STATE_TABLE.add_command(STATENAME, "option1", menu_cmd_option1,auto_help=True)
GLOBAL_STATE_TABLE.add_command(STATENAME, "option2", menu_cmd_option2,auto_help=True)
GLOBAL_STATE_TABLE.add_command(STATENAME, "menu", menu_cmd_menu,auto_help=True)
#the 'entry' command.
GLOBAL_STATE_TABLE.add_command(STATENAME, "option1", menu_cmd_option1)
GLOBAL_STATE_TABLE.add_command(STATENAME, "option2", menu_cmd_option2)
GLOBAL_STATE_TABLE.add_command(STATENAME, "menu", menu_cmd_menu)
#-----------------------testing the depth of the state system
# This is a test suite that shows off all the features of the state system.
@ -234,7 +232,7 @@ GLOBAL_STATE_TABLE.add_state(TSTATE6,exit_command=True,
allow_exits=True,allow_obj_cmds=True)
#append the "test" function to all states
GLOBAL_STATE_TABLE.add_command(TSTATE1,'test',cmd_instate_cmd,auto_help=True)
GLOBAL_STATE_TABLE.add_command(TSTATE1,'test',cmd_instate_cmd)
GLOBAL_STATE_TABLE.add_command(TSTATE2,'test',cmd_instate_cmd)
GLOBAL_STATE_TABLE.add_command(TSTATE3,'test',cmd_instate_cmd)
GLOBAL_STATE_TABLE.add_command(TSTATE4,'test',cmd_instate_cmd)