Adding new 'help'-like commands

Submitted by javelin on Sat, 2003-02-01 17:49

Let's say you want to a new indexed text file to support a command called 'rumor'. rumor is to work just like help, news, or events, but is to be based on a file game/txt/rumor.txt which will be automatically generated from files in the game/txt/rumor directory with names like january.rumor, february.rumor, etc.

This turns out to be pretty easy. You'll need to modify two files:

  • game/mush.cnf
  • game/txt/Makefile (for Unix-like systems)

Here's the plan:

  1. Edit game/mush.cnf, and add this line:
    help_command rumor txt/rumor.txt
  2. Users of Unix-like systems (including Windows systems like msys that provide bash, perl, and make):
    • Edit game/txt/Makefile. Find this line:
      TXT=help.txt news.txt events.txt

      Add your new file name. Now it look like this:

      TXT=help.txt news.txt events.txt rumor.txt

      Find these lines:

      rules.txt: rules/*.rules compose.sh
              ./compose.sh rules

      Make a copy of these lines right below them, and change 'rules' to 'rumor'. Now you have this:

      rules.txt: rules/*.rules compose.sh
              ./compose.sh rules
      
      rumor.txt: rumor/*.rumor compose.sh
              ./compose.sh rumor

      NOTE: The whitespace before './compose.sh' must bea single tab character, not spaces.

    • Create the game/txt/rumor directory and populated it with some files with names ending in .rumor (jan.rumor, feb.rumor, etc.) Each of these files should be in help file format (topic names beginning with &'s, followed by text, and the first line should be a topic name).
    • In the game/txt directory, type 'make', and you should see rumor.txt being created.
  3. Users of pure Windows systems without Unix-like shell environments should just create the file game/txt/rumor.txt and put all their entries in there.
  4. Shutdown and restart the MUSH and test out your new rumor command!