Posted by
| Zeno
USA (2,871 posts) bio
|
Message
| *nod*
Do you see anything wrong with this fix? It appears to be working.
else // Ok, they used the right syntax, lets fight out what our 'word' is.
{
char word[MAX_INPUT_LENGTH];;
word[0] = '\0';
int origX=x-2;
x++;
while ( isalpha(cmnd[x]) && cmnd[x] != '\0') // Lets find the next single word.
{
add_letter( word, cmnd[x]);
x++;
}
if ( word[0] != '\0' )
{
// If we get here, we assume we now have the word.
if (chkchar != NULL) // Begin looking for possible character matches.
{
if (!str_cmp( word, "name"))
{
if (IS_NPC(chkchar))
strcat( results, format( "%s", chkchar->short_descr) );
else
strcat( results, format( "%s", chkchar->name ));
}
if (!str_cmp( word, "sex"))
{
if (chkchar->sex == 2)
strcat( results, format( "%s", "female" ));
else
strcat( results, format( "%s", "male" ));
}
if (!str_cmp( word, "class"))
{
strcat( results, format( "%s", npc_class[chkchar->class] ));
}
if (!str_cmp( word, "race"))
{
strcat( results, get_race(chkchar) );
}
if (!str_cmp( word, "level"))
{
strcat( results, format( "%d", chkchar->level) );
}
// add your own char checks at this point
}
if (chkobj != NULL) // Then do objects.
{
if (!str_cmp( word, "level"))
{
strcat( results, format( "%d", chkobj->level) );
}
// add your own obj checks at this point
}
}
else
{
//no word
while ( origX < x )
{
add_letter( results, cmnd[origX]);
origX++;
}
}
if (cmnd[x] == '\0')
return results;
else
add_letter( results, cmnd[x]);
}
}
}
return results;
}
|
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | top |
|