Re: Redoing Advance...

From: Pj Bean (pj_bean@hotmail.com)
Date: 11/09/01


Below is your code all fixed up, Should have 0 problems,
The reason we dont use switch for things like you tried to do because almost
ALWAYS its for one character case checking, Its actually for numbers, but
since characters are converted into integers anyways, It accepts things like
position[0] the first letter of the array, I like your attempt, strcmp is
your best friend tho ...too bad they dont use strprefix *yes i will mention
this mroe then once: P* because now you have to do double check for strings
one with caps and one without ...strcmp being case sensitive and all ...
Let me know if theres still errors

/***************************************************************
* Command: advance                              Author: Andra *
*                                                             *
* USAGE: advance <person> <position>                          *
*                                                             *
* This command was rewritten because of the usage of levels.  *
* it has now been revamped so it WORKS and it has NOTHING to  *
* do with levels.                                             *
***************************************************************/

ACMD(do_advance) {
struct char_data *victim;
char *name = NULL, position = NULL;
logger[MAX_STRING_LENGTH];

argument = one_argument(argument, name);
one_argument(argument,position);

/* -- Beginning of Checks -- */
//ya ...
if (name != NULL) {
     if (!(victim = get_char_vis(ch, name, NULL, FIND_CHAR_WORLD))) {
         send_to_char("You cant seem to find them.\r\n", ch);
         return;
     }
} else {
         send_to_char("Advance Who?\r\n", ch);
         return;
        }

if (GET_LEVEL(ch) <= GET_LEVEL(victim)) {
   send_to_char("Maybe that's not such a great idea.\r\n", ch);
   return;
   }

if (position != NULL) {
   send_to_char("Advance them to WHAT!?\r\n", ch);
   return;
}

/* -- End of Checks -- */
if (!strcmp(position,"immortal") || !strcmp(position,"Immortal"))
        GET_LEVEL(victim) = LVL_IMMORT;
else if (!strcmp(position,"novice") || !strcmp(position,"Novice"))
GET_LEVEL(victim) = LVL_JRBUILD;
else if (!strcmp(position,"builder") || !strcmp(position,"Builder"))
GET_LEVEL(victim) = LVL_GOD;
else if (!strcmp(position,"advanced") || !strcmp(position,"Advanced"))
GET_LEVEL(victim) = LVL_ADVBUILD;
else if (!strcmp(position,"editor") || !strcmp(position,"Editor"))
    GET_LEVEL(victim) = LVL_EDITOR;
else if (!strcmp(position,"assistant") || !strcmp(position,"Assistant"))
GET_LEVEL(victim) = LVL_ASSIST;
else if (!strcmp(position,"supervisor") || !strcmp(position,"Supervisor"))
GET_LEVEL(victim) = LVL_IMMORT;
else if (!strcmp(position,"rule") || !strcmp(position,"Ruler"))
GET_LEVEL(victim) = LVL_JRBUILD;
else {
send_to_char("That's NOT a position!!\r\n",ch);
return;
}

sprintf(buf, "Your head floods with thoughts
of power and glory, and white
doves take flight into the pure
blue sky. The ringing of bells
can be heard in the distance,
making you rejoice. Your body
is taken to another dimension,
then snapped back to reality
with a sudden ring in your ears.

You have become a %s!", position);
send_to_char(buf,victim);
sprintf(logger, "(GC) %s advanced %s to %s", GET_NAME(ch), GET_NAME(victim),
  position);
send_to_char(buf, victim);
mudlog(logger, NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE);
return;
}


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/06/01 PST