[NEWBIE] [CODE] Advanced Creation

From: Corey Elliott (strmchsr@ARN.NET)
Date: 07/04/98


Well, for this being my first message to the list I am a bit embarassed =
with its simplicity.  I'm not yet a strong coder at all and I can't get =
in touch with my "mentor" that is helping code my MUD so I turned to you =
great people *grin*.

I'm currently coding advanced creation for my MUD (where you have the =
option to change your attributes when you create your character by =
adding and subtracting from them.  You are assigned a certain amount of =
Creation Points and every addition to a stat takes away from you points. =
 Get it?  I have coded all of this in interpreter.c in nanny() and it is =
a bit strange for me to code seeing how it is all a big collection of =
case statements.  Anyway, I have everything working fine except when I =
get to the code when I ask them what value they wish to change their =
stat to.  I can't seem to change the input into an integer so I can do =
my mathematics.  Here is a short sample just to get my idea across:

 case CON_CHANGE_STR:
 /*temp_stat =3D (int) arg;*/
 temp_stat =3D (int) arg;
 if ((temp_stat > 18) || (temp_stat < 1)) {
  SEND_TO_Q(temp_stat, d);
  SEND_TO_Q("Invalid choice.\r\n", d);
  SEND_TO_Q("Change strength to what? >", d);
  return;
  break;
 }=20
    load_result =3D temp_stat - GET_STR(d->character);
 if (temp_stat > GET_TRAINING(d->character)) {
  SEND_TO_Q("You don't have enough Creation Points.\r\n", d);
  SEND_TO_Q("Chage strength to what? >", d);
  break;
 }

I figured this would work, the "temp_stat =3D int (arg)" but it =
apparently doesn't.  When I try to do the math at the bottom, it won't =
work (I assuming because it's not an int.)  If you notice the line I =
have commented out, that way works but I'd have to type out every =
possible number, which works fine if I'm only dealing with 1-18 but when =
you start talking about the player modifying his HP's, out don't want to =
have to type out 150+ case statements in the parse_getint.  You see the =
"  SEND_TO_Q(temp_stat, d)", that is just stuck in there to see if the =
value is correct, and it is.  If anybody even understands what I'm =
rambling about, would you mind giving me a push in the right direction?  =



Corey Elliott
Lightning Photography Page:
http://users.arn.net/~strmchsr/Lightning.html
E-mail:
strmchsr@arn.net=20

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



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