Re: [NEWBIE] Getting OasisOLC

From: Sammy (samedi@DHC.NET)
Date: 08/07/97


On Thu, 7 Aug 1997, Sammy wrote:

Oops sorry guys I meant that to go to George alone.

Obcircle:

I've been working with adding a special parser function to the player
data.  Basically the idea is that when you want to prompt the player in
the middle of the game, you point the player at your parser function and
it sends their raw input to that function before command_interpreter
(which is only called if the parser returns a 0 to signal that it didn't
find any parseable data).

The advantage is that you can get some menu-like operation or fancy mob
interaction without putting the player in a new CON state, which
effectively takes them out of the game.  This way they don't miss anything
while they're considering or typing a response, and depending on the
operation of the parser, may still have all the normal commands available.
The other advantage is you can replace all the do_not_here entries in the
command table by changing spec_procs to praser procs.

Currently I'm using this to make some interactive mobs that need to
respond to yes/no responses in several contexts as well as some numerical
and other responses.  You could also use the idea for really simple
prompts like:

/* called by do_quit after asking player if they really want to quit */
PARSER(quit_query)
{
  if(!str_cmp(input, "yes")) {
    save_char(ch);
    ch->desc->connected = CON_CLOSE;
    return 1;
  } else if(!str_cmp(input, "no")) {
    send_to_char("Excellent choice!\r\n", ch);
    return 1;
  }
  return 0;
}

While the mud is waiting for a yes/no anser, the player isn't missing any
tells, and can tell back.  Heck, they can keep moving and fighting if they
want, tho you may want to null out the parser pointer when they move.

Sam


     +------------------------------------------------------------+
     | 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