Re: Act.informative.c

From: John C. Dodds (zzan@dbeach.com)
Date: 07/22/96


Adam Days wrote:
> 
> Okay I got this idea for a new thing when you do a "score' as a player.
> I want it to show you a life bar.  Now a full bar is fifty *'s
> 
> [ ************************************************** ](i hope that's right
> anyway depending on how much life the person has left, the bar goes down.
> i have figured out by how much by using a kind of formula:
> 
> Max Hit divided by 50(full life bar) = Hit Point Ratio (HPR)
> then Current Hit Points divided by the Hit Point Ratio equals the
> number of *'s shown in the bar.  This translates into this in code
> 
> #define GET_HPR(ch)     (GET_MAX_HIT(ch) / 50)
> #define ASTERISK(ch)    (GET_HIT(ch) / GET_HPR(ch))
> 
> now the hard part is to make bar show up in the score.
> I used a set space for the brackets on either side of the asterisks.
> however, I need help.  Right now instead of say having 45 asterisks
> showing it prints this:
> 
> [ 45                                                 ]
> instead of this:
> [ *********************************************      ]
> 
> I need to know how would I go about converting the number ASTERISK(ch)
> would come up with into that many *'s, without massive amounts of saying
> if (ASTERISK(ch) == 50) blah blah
> if (ASTERISK(ch) == 49) blah blah
> if (ASTERISK(ch) == 48) blah blah etc.......?
> 
> If anyone understands what I'm trying to say please help :~(
> 
> *******************************************************************************
>  Adam Days  a.k.a                 ** "Being an Outcast is only a frame of mind
>  Drizzt Do'Urden                  **  and not something that is placed upon
>  Unholy Lands <164.116.34.2 4000> **  you."  -Adam Days
> *******************************************************************************
um how about a loop that goes from 1 to asterisk(ch) and each time
through print an asterisk.  That would be how i would do it.

John



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