Re: <Rookie> Displaying Race (fwd)

From: Primacy (jmrobins@wired.uvm.edu)
Date: 10/15/96


> Could ya send me more in depth

Okay - here goes:

UTILS.H
	#define GET_RACE(ch)    ((ch)->player.race)    


CLASS.C  (THIS COULD ALSO BE PUT IN CONSTANTS.C)
	const char *pc_race_types[] = {
	   "Human",
	   "Troll",
	   "Giant",
	   "Blob",
	   "\n"};


ACT.INFORMATIVE.C  (This is a function for a WHO_IS command - shows what 
you need to do)
	extern char *pc_race_types[];
	extern char *pc_class_types[];

	ACMD(do_whois)
	{
	  struct char_data *victim = 0;
	  struct char_file_u tmp_store;
	
	  byte class, race = 0;
	
	  skip_spaces(&argument);
	
	  if (!*argument) { 
      send_to_char("Do a WhoIS on which player?\r\n", ch);
    } else {
      CREATE(victim, struct char_data, 1);
      clear_char(victim);
      if (load_char(argument, &tmp_store) > -1) {
        store_to_char(&tmp_store, victim);
        class = GET_CLASS(victim);
        race  = GET_RACE(victim);
        sprintf(buf, "%s is a, level %d, %s.\r\n", GET_NAME(victim), 
		GET_LEVEL(victim)), pc_race_types[(int) race]); 
        strcat(buf, pc_class_types[(int) class]);
        strcat(buf, "\r\n");
        send_to_char(buf, ch);
      } else {
        send_to_char("There is no such player.\r\n", ch);
      }
        free(victim);
    }
  }



There - that should help.  If you need some more info, just let me know.

Justin - Ruin! Mud ruin.org 4000
jmrobins@wired.uvm.edu

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