Anyone wanna help?

Posted by Zunit1920 on Tue 13 Dec 2005 10:12 PM — 8 posts, 24,834 views.

#0
Ok here the problem i get this error when i try to compile my mud:

act_comm.c: In function `do_teach':
act_comm.c:1220: warning: `vch' might be used uninitialized in this function



Code refers to this:
CHAR_DATA *vch;

and it is used here:

if( is_android( vch ) || is_superandroid( vch ) || is_bio( vch ) )
{
ch_printf(ch, "Androids can't learn this way.\n\r");
return;
}
USA #1
It's not an error, it's a warning. It shouldn't prevent a compile.
#2
Ok sry it wasnt because of that...

It was because of this

if( IS_NPC( vch ) )
{
ch_printf( ch, "Not on NPC's.\n\r" );
return;
}

But if i just ignore the warning and i use the skill it crashes the mud:/
USA #3
Well, just like the warning says. The variable may not be uninitialized. Which means vch may be nothing. You have to define it.
#4
right now its CHAR_DATA *vch;

Even when i put CHAR_DATA *vch = NULL; it crashes idk what to put instead of NULL
USA #5
That's declaring it. You need to make vch something. Like, who it is. I don't know what you expect to do, so I can't really suggest what to do.
#6
The command i created was do_teach


And all i want is if statement to do is check if its a computer (meaning not a player) and if it is a computer say not on npc's


vch is used also with the is_android(vch) and all that from earlier

You have any idea of what to put intead of NULL?
Amended on Tue 13 Dec 2005 11:08 PM by Zunit1920
USA #7
Yes, but you said "check if its...". I still don't know enough. What is "it"? Look over other functions like do_consider, maybe?