[Circle] [CODE] Snippet for Adding Level Based Helps

From: Ground Zero Enterprises (zero@baker.cnw.com)
Date: 11/08/96


	I know this is a very simple change but it works well and some 
newbie out there may find it useful, or if you just wanna put it in your 
mud cause you never looked it when busy with more important things.  
Anyway here it is:

in load_help in db.c:

just below the line -
  struct help_index_element el;

add-
  int level;

just above the line -
 /* now, add the entry to the index with each keyword on the keyword line */

add-
    if (sscanf(line, "# %d ", &level) != 1)
      level = 0;

and just below the line-
 el.entry = str_dup(entry);

add-
 el.level = level;

in help_file_element in db.h:

just below the line-
  int duplicate;

add-
  int level;

lastly in act.informative.c in do_help:

replace the line-
  page_string(ch->desc, help_table[mid].entry, 0);

with-
  if (help_table[mid].level <= GET_LEVEL(ch))
    page_string(ch->desc, help_table[mid].entry, 0);
  else
    send_to_char("There is no help on that word.\r\n", ch);


	It is not necessary to put a level on helps you do not want to be
restricted, they will boot just fine and level will default to 0, but for 
the helps you do want to be restricted this is how:

.......  other help entries  ..........
# 20
EXAMPLE HELP ENTRY

This is an example help entry.

See also: OTHER STUFF
# 30
  ^^---- this will make it so the _above_ help entry can only be accessed 
by level 30 characters or higher, the 20 level limit is for whatever 
entry is above that number
........   other help entries  ............

Hope someone finds this useful.
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/18/00 PST