Since my comments somehow disappeared from my last reply,
I'll try this again...
Dennis's 3-step solution to your problem:
First step: Try to remember back to when you learned how to program.
Especially try to remember the part about how an if-else works.
Here's a little problem for you to practice on:
if a
b = 3
else
c = b
What will c be if a is true? what if a is false?
Second step: If you do the first step, your first problem will be obvious
(it's in the first few lines of code you posted).
Third step: Pay attention to warnings. They're there for a reason.
For example, "value may be uninitialized" means that you may not be
initializing value. If you thought you were, you need to look at your
code better, especially the code you thought was initializing value.
There are some other problems as well, such as non-humans not being able
to ever get out of the eye color picker, but the problem I'm addressing
is the most important. Look at the first 4 lines of code you posted for
a logic error.
Dennis
On Sun, 3 Mar 2002 [EMAIL PROTECTED] wrote:
> I am trying to add in eye colors in the creation process. They are based on
> race, so its a little more difficult. I'm not that experienced yet, but I
> think this may work.
> I did code some stuff up and it worked EXCEPT, it did not assign the correct
> eye color, in fact, it assigned the eye color that is defined as 0 in merc.h.
> I did go into the player file, and change the value, from 0 to say, 2, and
> went back into the game. The change then DID reflect (2 was like green or
> something). But just during the roll up, no matter what eye color I choose,
> blue (value 0) is always given as their eye color.
> I tried numerous things try to have them assign the correct color, I even
> took out the race specific eye color, just to see if I could assign something
> else. But, I only get blue as an eye color. This is based on my god code, and
> I just made if statements for the race. When I did add this in, it said
> "value" may be unintialized. I then changed all the value to value3 in the
> con_get_new_eye, and put a value3=0;, as the first thing in con_get_new_eye
> and it went away, and it still didn't change anything.
> I've been trying to figure it out for about 3-4 hours and I've made no
> progress =/.
> This is the code I had:
>
> case CON_GET_NEW_EYE:
> if (is_number(argument))
> value3 = atoi(argument);
> else
>
> If (ch->race == race_lookup("human"))
> {
> send_to_desc("{YYour eye colors you can choose are:\n\r
> {x[1]Blue.\n\rWhat {RIS{c your the color of your eyes?{x ",d);
>
> switch ( value3 )
> {
> case 1: ch->eye = EYE_BlUE;
> break;
>
> default:
> send_to_desc("{cThat's not an eye color.\n\rWhat {RIS{c your the
> color of your eyes?{x ",d);
> return;
> }
> }
> else
> {
> {
> send_to_desc("{YYour eye colors you can choose are:\n\r{x
> [1]Red.\n\rWhat {RIS{c your the color of your eyes?{x ",d);
> return;
> }
> switch ( value3 )
> {
> case 1: ch->eye = EYE_RED;
> break;
>
> default:
> send_to_desc("{cThat's not an eye color.\n\rWhat {RIS{c your the
> color of your eyes?{x ",d);
> return;
> }
> }
> write_to_buffer( d, "\n\r\n\rWhat is your sex (M/F)?\n\r ",0);
> send_to_desc("\n\r{wYour choice or HELP for more info:{x\n\r",d);
> d->connected = CON_GET_NEW_SEX;
> break;
> ========================
>
> Thank you for your help.
>
>
>