And the parade of errors goes on....

Posted by Xinphinity on Thu 22 May 2003 07:38 PM — 2 posts, 11,989 views.

USA #0
I am trying to spit out a basic string of character info, name, race, age, etc. I thought this would do it, but it just returns the strings, and no ch data.

What am I doing wrong here?

~Xin

void do_info(CHAR_DATA * ch, char *argument)
{

if (IS_NPC(ch))
{
do_oldscore(ch, argument);
return;
}

pager_printf( ch, "\n\rYou are ", ch->name);
pager_printf( ch, ", a ", capitalize(get_race(ch)));
switch(ch->sex)
{
case 1: pager_printf( ch, " male");
case 2: pager_printf( ch, " female");
}
pager_printf( ch, ". You are ", get_age(ch));
pager_printf( ch, " years of age.\n\r");
return;

}
USA #1
Lemme guess, you've done a lot of scripting and Visual Basic. Not a real problem but theres some serious adjusting to be done here to get this to work.
Quote:

void do_info(CHAR_DATA * ch, char *argument)
{

if (IS_NPC(ch))
{
do_oldscore(ch, argument);
return;
}

Up until here you look good, this is where the problems start though.
Quote:

pager_printf( ch, "\n\rYou are ", ch->name);
pager_printf( ch, ", a ", capitalize(get_race(ch)));

Ok, to return the value rather than the variable here you need to use an identifier, %d for instance, to hold the place of the value you want to return as part of your printout. Granted, youre actually very close to proper formatting for doing this as a terminal application but that won't quite work in a mud environment.