# # $Id: help.pretty,v 1.18 1998/08/06 20:51:30 joi Exp $ # $Log: help.pretty,v $ # Revision 1.18 1998/08/06 20:51:30 joi # Fixied up some missed dbref references. Quoted into an empty mush. # # Revision 1.17 1998/08/06 19:56:27 joi # *** empty log message *** # # Revision 1.16 1998/08/06 19:55:55 joi # Updated for publishing. # # Revision 1.15 1998/02/18 04:20:50 joi # Added View commands. # # Revision 1.14 1998/01/18 21:49:00 joi # Added uselock checks to +lhelp so that only objects the player is # eligible to use display their local helps. # # Revision 1.13 1998/01/18 01:45:14 joi # Fixed a bug in +lhelp for when multiple objects are in the area that parent # to the same parent. # # Revision 1.12 1998/01/17 23:44:15 joi # Converted +lhelp commands to work for any object, not just ones I own, # by moving the codeto the wizzed object. Then added the ability to have # the +lhelp commands search all nearby objects for help topics, not just # the current room. NOw I can plaster help items on objects and use the # +lhelp command generically! # # Revision 1.11 1998/01/10 20:23:28 joi # Added HELPTITLE to second Lhelp variant I forgot the first time. # # Revision 1.10 1998/01/10 20:10:23 joi # Fixed a typo, removed the 'help' spam which is already listed in # the help help. Widened the +lhelp topic list columns. # # Revision 1.9 1998/01/10 19:04:01 joi # Added lhelp title attribute, and a paragraph about writing lhelp items. # # Revision 1.8 1998/01/05 03:09:22 joi # Repaired lhelp, so that it tracks up the parent chain to locate help_ attributes. # lattr() does not do this. # # Revision 1.7 1997/12/26 21:48:11 joi # Added test to +lhelp to shorten the output when there is no local help # present in the user's location. # # Revision 1.6 1997/12/26 17:30:45 joi # Converted to new pretty format. Added +lhelp command. # # Revision 1.5 1997/07/31 02:27:20 joi # Added inspiration command, reformated help help text. # # Revision 1.4 1997/07/21 21:57:47 joi # Added wiz flag check to +wizhelp commands. # # Revision 1.3 1997/07/21 21:45:30 joi # Added Wizhelp variant. # # Revision 1.2 1997/07/20 18:30:09 joi # Made banner a little more generic. # # Revision 1.1 1997/07/18 04:36:48 joi # Initial revision # ############################################################################## # # Introduction: # This file provides code and help topics for the following commands: # # +help - global user command # +wizhelp - global wizard-only help # +help and +wizhelp read topic information stored on a help-text object. # # +lhelp - global local help # +lhelp displays help topics stored on nearby objects and locations. # # +view - global view command # +view displays descriptions stored in view attributes on nearby objects # and locations. # # All of these commands accept wildcards. Both +lhelp and +view will display # help and view information from player-owned items. +lhelp will read help # topics on every nearby object, and thus can be used for documenting any # coded object, not just rooms. # ############################################################################## # Instructions: # # This file assumes the following objects already exist: # WIZZED OBJECT : object in your master room with wizard powers # HELP OBEJCT : the object where your +help system stores its topics # GLOBAL OBJECT : non-wizzed globals object in your master room # FUNCTIONS OBJECT: code object not in the master room # # If these objects don't already exist, your GOD will need to preform the # following commands: # # @create WIZZED OBJECT # @set WIZZED OBJECT=WIZARD # @set WIZZED OBJECT=COMMANDS # @create WIZZED OBJECT PARENT # @parent WIZZED OBJECT=WIZZED OBJECT PARENT # @teleport wizzed object=[master room] # # Any wizard can then perform the following commands: # # @create HELP OBJECT # @create FUNCTIONS OBJECT # @create GLOBAL OBJECT # @set GLOBAL OBJECT=commands # @teleport GLOBAL OBJECT=[master room] # # Once the objects are created, place attributes on yourself as follows: # # &DBREF_WIZZED_OBJECT me=[dbref of your wizard object] # &DBREF_WIZZED_OBJECT_PARENT me=[dbref of your wizard's parent object] # &DBREF_HELP_OBJECT me=[dbref of your help text object] # &DBREF_GLOBAL_OBJECT me=[dbref of your non-wizard globals object] # &DBREF_FUNCTIONS_OBJECT me=[dbref of your functions object] # # These attributes are only used during the quoting process and may be # removed when the installation is complete. # # Finally, unprettify this file and quote it into your mush. # # This can be done with TinyFugue in one step: # /quote -w -1 !"unprettify -v help.mush # and quote the "help.mush" file into your mush using whatever method # suits you. # # Alternatively, you can download help.mush from my website and quote # that directly. # # The supplied +help topics are compatible with the provided +help command. # # Help command # # /quote -wjoi -0 !"unprettify -v <~/MyMush/help.pretty" # # #include /home/joi/MyMush/dbrefs.inc - @fo me=&DBREF_HELP_OBJECT [v(dbref_global_object)]= [v(dbref_help_object)] - @fo me=&DBREF_GLOBAL_OBJECT [v(dbref_wizzed_object_parent)]= [v(dbref_global_object)] - @fo me=&DBREF_FUNCTIONS_OBJECT [v(dbref_global_object)]= [v(dbref_functions_object)] - &U_HUH [v(dbref_functions_object)]= Huh?%b%b(Type "help" for help.) - &DO_HELP_COMMAND2 [v(dbref_global_object)]=$+help: @pemit %# = [setq(0, iter( edit(sort(lattr(v(dbref_help_object)/HELP_*)),HELP_,), switch(1,strmatch(##,*_*),,isnum(right(##,1)),,##) ) )] { [repeat(=,78)] %rThe following global topics are available: %r[repeat(-,78)] %r[iter(%q0, switch(mod(match(%q0,##),4),1,%r) %b%b[ljust(lcstr(edit(##,_,%B)),15)] )] [switch(hasflag(owner(%#),W),1,%r%r{Wizards have an equivalent +wizhelp command, also.})] %r%r[repeat(=,78)] } - &DO_HELP_COMMAND [v(dbref_global_object)]=$+help *: @pemit %# = [setq(0, sort(iter(lattr(v(dbref_help_object)/HELP_*), rest(##, _)), a))] [setq(1, matchall(%q0, [edit(secure(%0), %b, _)]))] [switch( words(%q1), 0, No such global help topic '[secure(%0)]'., 1, { [repeat(=,78)] %rHelp text for topic or global command \ [lcstr(edit(extract(%q0, %q1, 1), _, %b))]: %r[repeat(-,78)] %r%r[u(v(dbref_help_object)/HELP_[extract(%q0, %q1, 1)], %#)] %r%r[repeat(=,78)] }, { [repeat(=,78)]%r Here are the entries which match [secure(%0)]:%r [iter(%q1, switch(mod(match(%q1,##),3),1,%r%b%b) [ljust(lcstr(edit(extract(%q0,##,1),_,%b)),24)] )]%r %r [repeat(=,78)] } )] - &HELP_HELP [v(dbref_help_object)]= "The syntax of the command is: " +help " +help " +help " "Examples: " +help, +help mail, +help *send*, +help learn * " "The +help command provides information about softcoded commands not covered "in the Tinymush HELP command. " "'+help' provides a list of main topics. '+help ' provides a list of "subjects under a topic. '+help ' allows you to specify part of a "keyword and find all matching subjects. " "Inspiration for this command came from CrystalMush. - &DO_WIZHELP_COMMAND2 [v(dbref_global_object)]=$+wizhelp: @pemit %# = switch(hasflag(owner(%#),W),1, [setq(0, iter( edit(sort(lattr(v(dbref_help_object)/WIZHELP_*)),WIZHELP_,), switch(1,strmatch(##,*_*),,isnum(right(##,1)),,##) ) )] { [repeat(=,78)] %rThe following global topics are available: %r[repeat(-,78)] %r[iter(%q0, switch(mod(match(%q0,##),4),1,%r) %b%b[ljust(lcstr(edit(##,_,%B)),15)] )] %r%r[repeat(=,78)] }, {[u(v(dbref_functions_object)/u_huh)]} ) - &DO_WIZHELP_COMMAND [v(dbref_global_object)]=$+wizhelp *: @pemit %# = switch(hasflag(owner(%#),W),1, [setq(0, sort(iter(lattr(v(dbref_help_object)/WIZHELP_*), rest(##, _)), a))] [setq(1, matchall(%q0, [edit(secure(%0), %b, _)]))] [switch( words(%q1), 0, No such global help topic '[secure(%0)]'., 1, { [repeat(=,78)] %rHelp text for topic or global command \ [lcstr(edit(extract(%q0, %q1, 1), _, %b))]: %r[repeat(-,78)] %r%r[u(v(dbref_help_object)/WIZHELP_[extract(%q0, %q1, 1)], %#)] %r%r[repeat(=,78)] }, { [repeat(=,78)]%r Here are the entries which match [secure(%0)]:%r [iter(%q1, switch(mod(match(%q1,##),3),1,%r%b%b) [ljust(lcstr(edit(extract(%q0,##,1),_,%b)),24)] )]%r %r [repeat(=,78)] } )], [u(v(dbref_functions_object)/u_huh)] ); - # /quote -wjoi -0 !"unprettify -v U_LHELP_ITEMS <~/MyMush/help.pretty" &U_LHELP_ITEMS [v(dbref_functions_object)]= iter(lattr(%0/HELP_*),%0/##) - # /quote -wjoi -0 !"unprettify -v DO_LHELP_COMMAND2 <~/MyMush/help.pretty" # &DO_LHELP_COMMAND2 [v(dbref_wizzed_object)]=$+lhelp: @pemit %# = setq(2, iter( lcon(%l) %l, switch(elock(##/uselock,%#),1,lparent(##) ##) ) ) # [setq(1,iter(%q2,lattr(##/HELP_*)))] [setq(1, setunion( iter(lattr(%l/help_*),%l/##), iter(%q2,u(v(dbref_functions_object)/u_lhelp_items,##)) ) )] [setq(0, iter( edit(sort(%q1),HELP_,), switch(1,strmatch(##,*_*),,isnum(right(##,1)),,##) ) )] [switch(words(%q0),0,No local help is available., { [setq(3,sort(iter(%q0,after(##,/))))] [repeat(=,78)] %r[default(%l/HELPTITLE,The following local topics are available:)] %r[repeat(-,78)] %r[iter(%q3, switch(mod(match(%q3,##),3),1,%r) %b%b[ljust(lcstr(edit(##,_,%B)),20)] )] # ############################################################################## %r%r # [switch(hasflag(owner(%#),W),1,%r%r{Wizards have an equivalent +wizhelp command, also.})] # %r%r [repeat(=,78)] } )] - # /quote -wjoi -0 !"unprettify -v DO_LHELP_COMMAND <~/MyMush/help.pretty" # &DO_LHELP_COMMAND [v(dbref_wizzed_object)]=$+lhelp *: @pemit %# = setq(3, iter( lcon(%l) %l, switch(elock(##/uselock,%#),1,lparent(##) ##) ) ) [setq(2, setunion( iter(lattr(%l/help_*),%l/##), iter(%q3,u(v(dbref_functions_object)/u_lhelp_items,##)) ) )] [setq(0, sort(iter(%q2, rest(##, _)), a))] [setq(1, matchall(%q2, */HELP_[edit(secure(%0), %b, _)]))] [switch( words(%q1), 0, No such local help topic '[secure(%0)]'., 1, { [repeat(=,78)] [setq(4,extract(%q2,%q1,1))] %r %r[default(before(%q4,/)/HELPTITLE,Help text for topic or local command)]: \ [lcstr(edit(rest(%q4,_),_,%b))] # \ [lcstr(edit(extract(%q0, %q1, 1), _, %b))] %r[repeat(-,78)] %r%r[u(%q4)] %r%r[repeat(=,78)] }, { [repeat(=,78)]%r Here are the entries which match [secure(%0)]:%r [iter(%q1, switch(mod(match(%q1,##),3),1,%r%b%b) [ljust( lcstr( edit( rest( extract(%q2,##,1), _ ), _, %b ) ), 24 )] )]%r %r [repeat(=,78)] } )] - # # Help Template entry. # /quote -wjoi -0 !"unprettify -v HELP_LHELP <~/MyMush/help.pretty" # &HELP_LHELP [v(dbref_help_object)]= "The syntax of the command is: " +lhelp " +lhelp " +lhelp " "The +lhelp command provides information about softcoded commands not covered "in the Tinymush HELP command or in the global +help system. Generally "this is limited to commands available in your present location. " "'+lhelp' provides a list of main topics. '+lhelp ' provides a list of "subjects under a topic. '+lhelp ' allows you to specify part of a "keyword and find all matching subjects. " "Help topics are stored on rooms or objects in attributes of the form: "&HELP_TOPIC_\[SUBTOPIC\]. &HELPTITLE will be used at the top of each page "if it is present, otherwise the default title is used. " "Inspiration for this command came from CrystalMush. - # /quote -wjoi -0 !"unprettify -v U_VIEW_ITEMS <~/MyMush/help.pretty" &U_VIEW_ITEMS [v(dbref_functions_object)]= iter(lattr(%0/VIEW_*),%0/##) - # /quote -wjoi -0 !"unprettify -v DO_VIEW_COMMAND2 <~/MyMush/help.pretty" # &DO_VIEW_COMMAND2 [v(dbref_wizzed_object)]=$+view: @pemit %# = setq(2, iter( lcon(%l) %l, switch(elock(##/uselock,%#),1,lparent(##) ##) ) ) # [setq(1,iter(%q2,lattr(##/VIEW_*)))] [setq(1, setunion( iter(lattr(%l/view_*),%l/##), iter(%q2,u(v(dbref_functions_object)/u_view_items,##)) ) )] [setq(0, iter( edit(sort(%q1),VIEW_,), switch(1,strmatch(##,*_*),,isnum(right(##,1)),,##) ) )] [switch(words(%q0),0,There are no viewable objects here., { [setq(3,sort(iter(%q0,after(##,/))))] [repeat(=,78)] %r[default(%l/VIEWTITLE,The following viewable objects are available:)] %r[repeat(-,78)] %r[iter(%q3, switch(mod(match(%q3,##),3),1,%r) %b%b[ljust(lcstr(edit(##,_,%B)),20)] )] # ############################################################################## %r%r [repeat(=,78)] } )] - # /quote -wjoi -0 !"unprettify -v DO_VIEW_COMMAND <~/MyMush/help.pretty" # &DO_VIEW_COMMAND [v(dbref_wizzed_object)]=$+view *: @pemit %# = setq(3, iter( lcon(%l) %l, switch(elock(##/uselock,%#),1,lparent(##) ##) ) ) [setq(2, setunion( iter(lattr(%l/view_*),%l/##), iter(%q3,u(v(dbref_functions_object)/u_view_items,##)) ) )] [setq(0, sort(iter(%q2, rest(##, _)), a))] [setq(1, matchall(%q2, */VIEW_[edit(secure(%0), %b, _)]))] [switch( words(%q1), 0, No such local viewable object '[secure(%0)]'., 1, { [repeat(=,78)] [setq(4,extract(%q2,%q1,1))] %r %r[default(before(%q4,/)/VIEWTITLE,Description of viewable object)]: \ [lcstr(edit(rest(%q4,_),_,%b))] # \ [lcstr(edit(extract(%q0, %q1, 1), _, %b))] %r[repeat(-,78)] %r%r[u(%q4)] %r%r[repeat(=,78)] }, { [repeat(=,78)]%r Here are the entries which match [secure(%0)]:%r [iter(%q1, switch(mod(match(%q1,##),3),1,%r%b%b) [ljust( lcstr( edit( rest( extract(%q2,##,1), _ ), _, %b ) ), 24 )] )]%r %r [repeat(=,78)] } )] - # # Help Template entry. # /quote -wjoi -0 !"unprettify -v HELP_VIEW <~/MyMush/help.pretty" # &HELP_VIEW [v(dbref_help_object)]= "The syntax of the command is: " +view " +view > " +view " "The +view command allows you to view the descriptions of nearby virtual "objects. " "This is limited to commands available in your present location. " "'+view' provides a list of objects. '+view ' provides a list of "subjects under an object. '+view ' allows you to specify part of a "keyword and find all matching objects. " "Viewable objects are stored on rooms or objects in attributes of the form: "&VIEW_TOPIC_\[SUBTOPIC\]. &VIEWTITLE will be used at the top of each page "if it is present, otherwise the default title is used. " "Inspiration for this command came from CrystalMush. -