Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ SMAUG
➜ SMAUG coding
➜ And the parade of errors goes on....
|
And the parade of errors goes on....
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Xinphinity
USA (26 posts) Bio
|
| Date
| Thu 22 May 2003 07:38 PM (UTC) |
| Message
| 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;
} | | Top |
|
| Posted by
| Meerclar
USA (733 posts) Bio
|
| Date
| Reply #1 on Thu 22 May 2003 08:28 PM (UTC) |
| Message
| 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.
|
Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org | | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
10,734 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top