Re: [CODE] Race help

From: Ron Hensley (ron@CROSS.DMV.COM)
Date: 03/15/98


> case CON_QRACE:
>     load_result = parse_race(*arg);
>     if (load_result == RACE_UNDEFINED) {
>       SEND_TO_Q("\r\nThat's not a race.\r\nRace: ", d);
>       return;
>     }
>     else if(load_result == RACE_HELP) {
>       page_string(d, race_help, 1);
>       SEND_TO_Q(race_menu, d);
>       STATE(d) = CON_QRACE;
>       break;
>     }
>     else
>       GET_RACE(d->character) = load_result;

This is because your page string does not cause output to be sent to the
player immediately, only to be buffered for later output. Remember the
mud multitasks, and halting to send 2 pages of info to one player would
lock up the mud. Thus you toss a paragraph into a buffer to be sent to
the player at a later time, and you also send the the race menu, at the
same time. Without going and looking at page_string, id imagine it sends
one line of text into the buffer, and withholds the rest for later, then
your race_menu gets shoved into the buffer ontop of the race_help.

What i did was this:
    else if (load_result == RACE_HELP) {
      SEND_TO_Q(race_help_menu, d);
      STATE(d) = CON_RACE_HELP;
      SEND_TO_Q("\r\nHelp on Race? ", d);
      return;
    } else
      GET_RACE(d->character) = load_result;

    load_result = parse_race_help(*arg);
    if (load_result == RACE_HELP_UNDEFINED) {
      SEND_TO_Q("\r\nThat's not a race.\r\nHelp on Race? ", d);
      return;
    }
    else if (load_result == RACE_SELECT) {
      SEND_TO_Q(race_menu,d);
      SEND_TO_Q("\r\nRace: ", d);
      STATE(d) = CON_QRACE;
      return;
    }
    else {
      switch (load_result) {
        case 0:
          SEND_TO_Q("\r\nHobbits are a sturdy race. They are very short ..
          SEND_TO_Q("\r\nWhile generally a very merry folk, they can be ..
          etc...
        default:
          SEND_TO_Q("\r\nHelp is not yet defined for that race.",d);
      }
      SEND_TO_Q(race_help_menu, d);
      SEND_TO_Q("\r\nHelp on Race? ", d);
      return;
    }


const char *race_help_menu =
"\r\n"
"Select a race to view:\r\n"
"  [A] Hobbit\r\n"
"  [B] Elf\r\n"
"  [C] Dwarf\r\n"
"  [D] Human\r\n"
"  [E] Ent\r\n"
"  [F] Eagle\r\n"
"  [G] Orc\r\n"
"  [H] Troll\r\n"
"  [I] Black Numenorean\r\n"
"  [X] Exit Race Help\r\n";

So what im doing, is showing them a selection of races to choose help on, as
well as an option to quit back to race selection.
Once a choice is made, display help on that race, using multiple send_to_q
calls as send_to_q is limited in how much it can display at once, though
i imagine a page_string would would fine, then go back
to awaiting the next race to show help on, or exit back to race select.

    *******************************************************************
    *   Ron Hensley                     ron@dmv.com                   *
    *   Network Administrator           http://www.dmv.com/~ron       *
    *                                   PGP Key at WWW Page           *
    *   DelMarVa OnLine                 749-7898 Ext. 403             *
    *******************************************************************


     +------------------------------------------------------------+
     | 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/15/00 PST