Help entry levels [by DOOMer]
Snippet Posted Wednesday, August 12th @ 11:28:16 PM, by George Greer in the Utils dept.
Added Jun 23, 1997. Click the link below to read it or download it.

From: DOOMer <doomer@bayou.com>
Subject: Help file levels

Me and my builders had gotten to talking and they got to griping
why if they can read the help files on LVL_CODER+ commands why
they can't use 'em...

Well i told em b/c i didn't WANT them using them... so i got the
idea in my head to make an addition to the help files that would
be backward-compatible (so i dont have to go edit the ENTIRE help
file... well, this is what i did.... I made it where each
help entry has its on Minimum Level to read (like objects have Min
level to use <this i imp'd too>)

well what follows is a drop-in addition that defaults the level
of help files to whatever you want (although i put it to 0 for simple
reasons)  and this way you can make  SEPARATE help entries in one help
file available to different people...
here goes...
--------------************************************------------------------
NOTE: THIS IS NOT A PATCH-- I didn't put it as a patch for the fact
that i don't condone patches (i particularly hate em and handpatch myself)
... this allows people to see (even though it was a small addition that
took only 5 minutes to add) how the code works... and etc (redundant i know)
--------------************************************------------------------
        FILE         FUNCTION/Struct
**************************************************
>>--    db.h      struct help_index_element {
    add an extra element called

    int min_level;

***************************************************
>>--    db.c       void load_help(FILE *fl)
wAFTER
    while (*line != '#') {
      strcat(entry, strcat(line, "\r\n"));
      get_one_line(fl, line);
    }
INSERT
    el.min_level = 0;
    if ((*line == '#') && (*(line + 1) != 0))
       el.min_level = atoi((line + 1));

    el.min_level = MAX(0, MIN(el.min_level, LVL_IMPL));

*****************************************************
>>-- act.informative.c   ACMD(do_help)
AFTER
       while ((mid > 0) &&
         (!(chk = strn_cmp(argument, help_table[mid - 1].keyword, minlen))))
        mid--;
CHANGE
       page_string(ch->desc, help_table[mid].entry, 0);
       return;
TO
     if (GET_LEVEL(ch) < help_table[mid].min_level)
         send_to_char("There is no help on that word.\r\n", ch);
      else page_string(ch->desc, help_table[mid].entry, 0);
     return;

*********************************************************

That should do it... the page_string is the function
my mud uses to Show a page at a time to characters...
not sure if its stock circle or not b/c ive changed the
code so much.... but anyway... that's how i did it... and
it works with old help files too...

Now... normal entries in the help files
look like this (not including the ------'s):
----------------------------------------------------------------------
ADVANCE

Usage: advance <victim> <level>

ADVANCE moves a player to a new level.  If used to promote a player to an
immortal level, and if you have the autowiz program installed, the wizlist and
immlist will automatically be recreated.

Example:

  > advance rasmussen 34

See also: SET
#
----------------------------------------------------------------------
If you wanted only Level 58+ (i have 60 levels on my mud)
to be able to read this help entry you just add
the level number after the # character
of course this DOES become a pain in the butt to change
the help files if you ever change the number of levels on your MUD
after you have changed the help files
but that's another post :-)

so if you wanted level 58+ to be able to read this and not 57 and below
just change the
#  (on a line by itself singnifies the end of the help entry)
to
#58    (you can't put comments after this now though)

its just that simple

if anyone thinks i forgot anything or if anyone would like to make
comments please do.... i'm up for criticism but if you use this please at
least send me an email stating you used my code... so i can feel good
about my code being used somewhere other than my mud :-)

Thanx all... and hope ya like it

Akuma the Raging Coder


<< Hand to hand Combat [by Demond De Inosantos] | Reply | View as text | Threaded | Help Index Command [by Angus Mezick] >>

 


Related Links
  download
Related Articles
More by greerga
 
 

CircleMUD Snippets
 
Note: Not all of these snippets will work perfectly with your version of code, so be prepared to fix one or two bugs that may arise, and please let me know what you needed to do to fix it. Sending a corrected version is always welcome.
Finally, if you wish to use any of the snippets from this page, you are more than welcome, just mention the authors in your credits. If you wish to release any of these snippets to the public on another site, contact me FIRST.