root/1.8.3/trunk/src/cmdlocal.dst
| Revision 1167, 2.4 kB (checked in by shawnw, 10 months ago) |
|---|
| Line | |
|---|---|
| 1 | /* -*- c -*- |
| 2 | /*----------------------------------------------------------------- |
| 3 | * Local stuff |
| 4 | * |
| 5 | * This file contains custom stuff, and some of the items here are |
| 6 | * called from within PennMUSH at specific times. |
| 7 | */ |
| 8 | |
| 9 | /* Here are some includes you're likely to need or want. |
| 10 | */ |
| 11 | #include "copyrite.h" |
| 12 | #include "config.h" |
| 13 | #include <string.h> |
| 14 | #include "conf.h" |
| 15 | #include "externs.h" |
| 16 | #include "parse.h" |
| 17 | #include "htab.h" |
| 18 | #include "flags.h" |
| 19 | #include "command.h" |
| 20 | #include "cmds.h" |
| 21 | #include "confmagic.h" |
| 22 | |
| 23 | extern HASHTAB htab_reserved_aliases; |
| 24 | |
| 25 | /* Called during the command init sequence before any commands are |
| 26 | * added (including local_commands, below). This is where you |
| 27 | * want to reserve any strings that you *don't* want any command |
| 28 | * to alias to (because you want to preserve it for matching exits |
| 29 | * or globals) |
| 30 | */ |
| 31 | void |
| 32 | reserve_aliases(void) |
| 33 | { |
| 34 | #ifdef EXAMPLE |
| 35 | /* Example: Don't alias any commands to cardinal directions. |
| 36 | * Remove the #ifdef EXAMPLE and #endif to use this code |
| 37 | */ |
| 38 | reserve_alias("W"); |
| 39 | reserve_alias("E"); |
| 40 | reserve_alias("S"); |
| 41 | reserve_alias("N"); |
| 42 | reserve_alias("NW"); |
| 43 | reserve_alias("NE"); |
| 44 | reserve_alias("SW"); |
| 45 | reserve_alias("SE"); |
| 46 | reserve_alias("U"); |
| 47 | reserve_alias("D"); |
| 48 | #endif |
| 49 | } |
| 50 | |
| 51 | #ifdef EXAMPLE |
| 52 | COMMAND(cmd_local_silly) |
| 53 | { |
| 54 | if (SW_ISSET(sw, SWITCH_NOISY)) |
| 55 | notify_format(player, "Noisy silly with %s", arg_left); |
| 56 | if (SW_BY_NAME(sw, "VERY")) |
| 57 | notify(player, "The following line will be very silly indeed."); |
| 58 | notify_format(player, "SillyCommand %s", arg_left); |
| 59 | } |
| 60 | #endif |
| 61 | |
| 62 | |
| 63 | /* Called during the command init sequence. |
| 64 | * This is where you'd put calls to command_add to insert a local |
| 65 | * command into the command hash table. Any command you add here |
| 66 | * will be auto-aliased for you. |
| 67 | * The way to call command_add is illustrated below. The arguments are: |
| 68 | * Name of the command, a string ("@SILLY") |
| 69 | * Command parsing modifiers, a bitmask (see hdrs/command.h) |
| 70 | * Flags to restrict command to, a string ("WIZARD ROYALTY") or NULL |
| 71 | * (Someone with *any* one of these flags can use the command) |
| 72 | * Powers to restrict command to, a string ("SEE_ALL") or NULL |
| 73 | * (Someone with this power can use the command) |
| 74 | * Switches the command can take, a string or NULL ("NOISY NOEVAL") |
| 75 | * Hardcoded function the command should call (cmd_local_silly) |
| 76 | */ |
| 77 | void |
| 78 | local_commands(void) |
| 79 | { |
| 80 | #ifdef EXAMPLE |
| 81 | command_add("@SILLY", CMD_T_ANY, "WIZARD ROYALTY", "SEE_ALL", |
| 82 | "NOISY NOEVAL VERY", cmd_local_silly); |
| 83 | #endif |
| 84 | } |
Note: See TracBrowser for help on using the browser.
