Re: [IDEA] Global on/off values

From: Daniel A. Koepke (
Date: 01/09/01

On Tue, 9 Jan 2001, Kaun Lazaro wrote:

> I'm wanting to write a piece of code that has a command to turn it on or
> off, once turned on another command would let players use the code,
> something like boosting dr/hr untill they level...
> any ideas?

Absolutely none.  You might try repeating that in English.

I'll take a stab at it, though.

You appear to want a command that may be enabled by an immortal, which
does something (I have no idea what).  So, how about:

    char arg[MAX_INPUT_LENGTH];
    static bool enabled = FALSE;

    if (GET_LEVEL(ch) < LVL_GRGOD && !enabled) {
      send_to_char("Huh?!\r\n", ch);
    } else if (GET_LEVEL(ch) >= LVL_GRGOD) {
      one_argument(argument, arg);

      if (!str_cmp(arg, "on")) {
        enabled = TRUE;
        send_to_char("Enabled.\r\n", ch);
      } else if (!str_cmp(arg, "off")) {
        enabled = FALSE;
        send_to_char("Disabled.\r\n", ch);

    /* Now do whatever you want... */

Insert the command in the command table as per usual.  Greater gods and
above will then be able to use 'whatever on' to turn the command on, and
'whatever off' to turn the command off.  When the command is off, the only
people that can use it are greater gods and above.  When on, anyone can
use it (but only greater gods and above can turn it on/off).


   | FAQ: |
   | Archives: |

This archive was generated by hypermail 2b30 : 12/03/01 PST