Re: [OFFTOPIC] {dmitri's stupid response}

From: Daniel Koepke (dkoepke@CALIFORNIA.COM)
Date: 12/30/97


On Tue, 30 Dec 1997, Doppleganger Software wrote:

->Speaking of which, how hard would it be to make it so that
->spec_procs can trap non-command-list commands?

I, being the lazy fool that I am, would find the line

  if (*cmd_info[cmd].command == '\n')

in the command interpreter and right before the send_to_char() line
put:

    if (no_specials || !special(ch, cmd, line))

So, the final code would read:

  if (*cmd_info[cmd].command == '\n')
    if (no_specials || !special(ch, -1, argument))
      send_to_char("Huh?!?\r\n", ch);

Then just have your specials make sure that if the second parameter
(which is an integer that refers to the position of a command in the
command table) is -1, that it gets the first word (using
any_one_arg(), not one_argument()) of the passed string.  Then, of
course, have the command return FALSE if it isn't the word it was
looking for.  Something like,

  SPECIAL(spec_example)
  {
    char word[MAX_INPUT_LENGTH];
    if (cmd != -1) // we only want non-command entry word checking
      return FALSE;
    argument = any_one_arg(argument, word);
    if (!str_cmp(word, "example"))
      return FALSE; // send Huh?!?

    // otherwise, we have the word 'example' followed by one or more
    // arguments.  This makes it possible/feasible for us to write
    // commands that not only exist in just one room, but perform
    // differently for different rooms, too; which is a rather strange
    // idea.

    // For instance, the word 'stir' can be detected by an big black
    // kettle.  While in Froboz's Workshop, the command 'stir' can
    // have you go about stirring and mixing potions, with a chance
    // that it will blow-up in your face.

    // While this is, somewhat, possible using conventional means,
    // I don't like the idea of having an ACMD() function check to see
    // if there's object #xxx (a black kettle) to see if it should
    // perform, and then check if we are in Froboz's workshop.  It
    // seems greatly more intuitive to attach the commands to it's
    // parent object (sorry for the OO terminology).

    return TRUE;
  }

Anyway, that's my worthy conribution for December (seems like I'm
having less and less to say; which isn't necessarily a bad thing, as
I'm more than happy to see that a few people on the list have become
more productive [not to say that is a result of my increasing
infrequency or that any manner of intelligent showings by once-newbies
has anything to do with me, because I doubt it does]).

I hate Christmas...


-dak


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



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