Re: [Circle] Displaying STR,CON,DEX, etc...

From: DJ Pure (pure@ozramp.net.au)
Date: 11/16/96


> 
> The subject says it all... How do you display those statistics? strength
> dexterity charisma etc...

	Check utils.h (i think)
it has these absolutly wicked definitions in there that return results
(strings, ints or whatever - depends on the definition).

to print strength ->

	printf ("Strength = %d\n", GET_STR(ch));

now ch may change, depending on where you are in your code. Like i printed
out the value of strength to the screen to test a newbie rolling function,
which was in nanny, so i had to do this ..

	printf ("Strength = %d\n", GET_STR(d->character));

anyway's you get the drift. Check the utils.h

Also, for the race parser, if you used the races doc, there is a function
in utils.h that returns an integer. this integer is the number of the
race, which is definined in structs.h

lets say you did this.
<structs.h>

#define race_1  0
#define race_2  1
#define race_3  2
#define no_race -1
#define num_races 3

then the GET_RACE is
#define GET_RACE(ch)    ((ch)->player.race)  [provided that races are
saved in that structure]

now that returns an integer of -1, 0, 1 or 2

Now the parser should be like this then

<in races.c>
...
// This is the names that get printed out on the screen.
const char *pc_race_types[] = {"race 1", "race 2", "race 3", "\n"); 

int parse_race(int arg)
/* Race Parser now takes integers in as input, instead of a single
charater.
   The switch statement is also fixed up to take ints, instead of chars.
Now
   the parser can determine races of number 10 and up so more can be added
in
   later - Jus
*/
{
	switch (arg) {
	case 1 :
		return race_1;     break;
	case 2:
		return race_2;       break;
	case 3:
		return race_3;     break;
	default :
		return no_race; break;
  }
}


*DISCLAIMER -> i'm a pesant coder ... so some of this might not work for
OTHER peoples codes ..

And of course, i didn't use the races i have in my mud for protection
reasons, but now the races can go over 10 where before i couldn't (i wish
i knew that after i threw in my 12 races .. *sigh*).

	Jussy


+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



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