Re: Graphical Bar Code?

From: Daniel A. Koepke (dkoepke@circlemud.org)
Date: 07/26/02


On Fri, 26 Jul 2002, Mathew Earle Reuther wrote:

> Works quite well, so you can set it to what you need for any given bar
> you're making.

I wouldn't recommend having bars of differing scales unless there's some
visual clue of the scale.  Otherwise, it's impossible to read *any* of the
bars without secondary information.  I'm assuming that the bar is meant to
be a quick visual aid, so the player can glance at it to determine his
status.  By having bars of various scales scattered about the interface,
the user must know beforehand that, on his health bar, 3 stars mean 30%;
if he has to stop and think about it, you've defeated your own purpose.

If you really do want to have bars of different length, then consider:

  char *bar(char *buffer, int M, int per, int scale)
  {
    const char barChar = '*';
    const char bgChar = ':';
    int barLen = MIN(M - 1, per / scale);
    int bgLen = MIN(M - 1, 100 / scale);

    memset(buffer, bgChar, bgLen);
    memset(buffer, barChar, barLen);

    *(buffer + bgLen) = '\0';
    return buffer;
  }

  /* ... macros the same ... */

which, used like

  char hb[21], vb[21], mb[21];
  send_to_char(ch, "HEALTH: %s\n"
                   "MOVE:   %s\n"
                   "MANA:   %s\n",
               SBAR(hb, GET_HIT(ch), GET_MAX_HIT(ch), 5),
               SBAR(vb, GET_MOVE(ch), GET_MAX_MOVE(ch), 5),
               SBAR(mb, GET_MANA(ch), GET_MAX_MANA(ch), 5));

produces results like:

  HEALTH: ******::::::::::::::
  MOVE:   **********::::::::::
  MANA:   **::::::::::::::::::


> [snip other extensions]

Note that my point was simplicity, not exhaustiveness.  It's trivial to
add all of these whizbang features to it, but I don't think its necessary
for creating an attractive visual aid.  Moreover, I think it can detract
from the purpose -- the more the user is distracted by its appearance, the
less useful it is to them.


-dak

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT