Re: {coding} prompts

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


On Wed, 12 Nov 1997, Ben Britton wrote:

->Has anyone ever toyed with the idea of a prompt that is fixed to the
->bottom of the screen that details everything? or a top tactical that
->allows you to see who is in the room.  I believe that you would need
->a VT102 interface with alot of extra coding and I was wondering if
->anyone has toyed with this idea?

Thoroughly discusses before, the general consensus was that in order
for it to be at least semi-affective, you needed to only update it
when the information changes and only update the changed information.
The rest is simply done by a few VT102 commands; no need for an
"interface", really.  Just learn the proper commands for saving cursor
position, setting the text window, locating the cursor, resorting
cursor position.

It goes like this:

  - save cursor position (so we know where to go back to after we have
    updated our status bar)

  - set the writable window size to the full screen (so we can draw
    the status bar, which, to prevent it from scrolling, is outside
    this rectangle)

  - locate the cursor at the proper place and write out the updated
    information

  - restore the cursor position

  - set the writable window size to exclude the bottom line (so now
    all output goes above the status bar, and scrolls in that portion
    of the screen)

A note on only writing out the updated information: figure out what
you want to have in your status bar, then create a little structure
for the player that contains this information and put it into
char_data.  So, let's say we just wanted Hp, Mp, Mv on it:

  struct status_data {
     int hp;
     int mp;
     int mv;
  };

Now in our game loop, where we send out prompts, we want to do the
status bar thing like this:

  /* check if they want a status bar, and if the info has been changed */
  for (d = descriptor_list; d; d = d->next)
    if (d->ch && PRF_FLAGGED(d->ch, PRF_STATUS) &&
        (d->ch->status.hp != GET_HIT(d->ch) ||
         d->ch->status.mp != GET_MANA(d->ch) ||
         d->ch->status.mv != GET_MOVE(d->ch)) {
      .
      .
      . code to update status bar
      .

      d->ch->status.hp = GET_HIT(d->ch);
      d->ch->status.mp = GET_MANA(d->ch);
      d->ch->status.mv = GET_MOVE(d->ch);
    }

On a more miscellaneous note, it might be favorable to look into doing
this in the same manner that bpl12 does in tacking on the prompt data
to the end of other output to avoid sending seperate packets.


daniel koepke / dkoepke@california.com


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