Re: In game Class Joining

From: Tony Robbins (tonyr@pacific101.com)
Date: 05/31/99


struct {
  byte chclass;
  char *in_message;
  room_vnum join_room;
} guild_data[NUM_CLASSES] = {
  /* you could also expand this to have more info for each guild. */
  { CLASS_MAGIC_USER, "The high magus calmly writes your name into the guild
roster.\r\n",   3023 },
  { CLASS_CLERIC,     "Herman, the cleric guildmaster, nods at you and
accepts you into the guild.\r\n", 3024 },
  { CLASS_THIEF,      "Fingers McGee glances you over and accepts you into
the guild.\r\n",    3025 },
  { CLASS_WARRIOR,    "The warrior guildmaster laughs loudly and accepts you
into the guild.\r\n", 3026 }
};

/* make the "enroll" command point to do_not_here in the command list.  Then
attach
   this special procedure to the appropriate rooms */
SPECIAL(enroll)
{
  int i;

  /* doesn't need any arguments, since you can only enroll in one guild per
room. */
  for (i = 0; i < NUM_CLASSES; i++) {
    if (world[IN_ROOM(ch)].number == guild_data[i].join_room)
      break;
    else if (i == NUM_CLASSES-1) {
      /* we can only get here if there were no matches.  log an error. */
      log("SYSERR: enroll spec_proc (wrongly) attached to room #%d",
world[IN_ROOM(ch)].number);
      return (TRUE);
    }
  }

  /* alright, we can assume everything is good to go. */
  GET_CLASS(ch) = guild_data[i].chclass;
  send_to_char(guild_data[i].in_message, ch);

  return (TRUE);
}

Alright, that should work, and it makes it easily expandable also.  Read
through it and e-mail me privately if you have any questions about it.  Oh,
and it's mailer code, so there's probably a bug or two (I expect the struct
to have a problem, it just seems wrong to me).  Also, you might want to set
up a system so they can change guilds if they want to, but that has a lot
more involved in it (if you save their various guild levels).

-k.

----- Original Message -----
From: Drew Johnston <Drew29028@aol.com>
To: <CIRCLE@post.queensu.ca>
Sent: Monday, May 31, 1999 10:10 AM
Subject:  In game Class Joining


*snip*

> ACMD(do_enroll)
> {
>   one_argument(argument, arg);
>
/* check out the for() loop above with the array of guild info.  this won't
work. */
>   if (!*arg && (ch->in_room != join_room))
>     send_to_char("Go to a guild if you wish to enroll!\r\n", ch);
>     /* above message is the one that pops up even when im in the right
room */
>
>   else if (!*arg && (ch->in_room == alchemist_join_room)) {
>     send_to_char("The alchemist guild leader nods his head and shakes your
> hand.\r\n", ch);
>     ch->player.chclass = CLASS_ALCHEMIST;
*snip*


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



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