Re: Act.informative.c

From: bub (bub@agis.ag.net)
Date: 07/22/96


I would do it this way...

int i;

for (i = 0; i <= ASTERISK(ch); i++)
  strcat (buf2, "*");

sprintf (buf, "[ %50s ]\r\n", buf2);
send_to_char (buf, ch);

I'm not sure if a - is needed in front of the 50 to align it right, 
you'll have to check it out =>

The MAD Coder,
Bub

Imp and coder of ?able Sanity (cslab.cc.cc.ca.us 4000)
Beta Playtesting coming soon!


On Mon, 22 Jul 1996, 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
> *******************************************************************************
> 
> 



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