Help with WHO?

Posted by Saint on Wed 30 Mar 2005 04:47 PM — 3 posts, 14,209 views.

#0
Alright guys. I fixed up my WHO list to the way I wanted it, however theres one small problem. I cant get it to center. Ugh this is annoying. I really want the WHO to display in the center of the screen. Any ideas? Heres my WHO code.

-----------------------------------------------------
void do_who (CHAR_DATA * ch, char *argument)
{
char buf[MAX_STRING_LENGTH];
BUFFER *output;
DESCRIPTOR_DATA *d;
int wlevel;
int nMatch;
int iMatch;
bool imm = FALSE;
bool mor = FALSE;
sprintf (buf, "\n\r {RC{rharmed{x\n\r\n\r");
send_to_char(buf, ch);
nMatch = 0;
iMatch = 0;
buf[0] = '\0';
output = new_buf ();
for ( wlevel=MAX_LEVEL; wlevel>0; wlevel-- )
{
for (d = descriptor_list; d != NULL; d = d->next)
{
CHAR_DATA *wch;
if (d->connected != CON_PLAYING || !can_see (ch, d->character))
continue;
wch = (d->original != NULL) ? d->original : d->character;
if( wch->level != wlevel )
continue;
if (wch->level >= 52)
imm = TRUE;
if (wch->level <= 51)
mor = TRUE;
if (!can_see (ch, wch))
continue;
}
}
if (imm)
{
sprintf (buf, " {R--{r={R-{r={R-{r={R-{r= {DImmortals {r={R-{r={R-{r={R-{r={R--{W{X\n\r\n\r");
send_to_char(buf, ch);
}
for ( wlevel=MAX_LEVEL; wlevel>0; wlevel-- )
{
for (d = descriptor_list; d != NULL; d = d->next)
{
CHAR_DATA *wch;
if (d->connected != CON_PLAYING || !can_see (ch, d->character))
continue;
wch = (d->original != NULL) ? d->original : d->character;
if( wch->level != wlevel )
continue;
if (!can_see (ch, wch))
continue;
if (wch->level < 52)
continue;
iMatch++;
sprintf (buf, "{m[ {x%6s {m]{x %s%s%s%s%s%s%s%s{X\n\r",
wch->race < MAX_PC_RACE ? pc_race_table[wch->race].who_name
: " ",
wch->incog_level >= LEVEL_HERO ? "(Incog) " : "",
wch->invis_level >= LEVEL_HERO ? "(Wizi) " : "",
clan_table[wch->clan].who_name,
IS_SET (wch->comm, COMM_AFK) ? "[AFK] " : "",
IS_SET (wch->act, PLR_KILLER) ? "(KILLER) " : "",
IS_SET (wch->act, PLR_THIEF) ? "(THIEF) " : "",
wch->name, IS_NPC (wch) ? "" : wch->pcdata->title);
add_buf (output, buf);
}
}
if (mor)
{
sprintf (buf, "\n\r {R--{r={R-{r={R-{r={R-{r= {D Mortals {r={R-{r={R-{r={R-{r={R--{W{X\n\r\n\r");
add_buf (output, buf);
}
for ( wlevel=MAX_LEVEL; wlevel>0; wlevel-- )
{
for (d = descriptor_list; d != NULL; d = d->next)
{
CHAR_DATA *wch;
if (d->connected != CON_PLAYING || !can_see (ch, d->character))
continue;
wch = (d->original != NULL) ? d->original : d->character;
if( wch->level != wlevel )
continue;
if (!can_see (ch, wch))
continue;
if (wch->level > 52)
continue;
nMatch++;
sprintf (buf, "{m[ {x%6s {m]{x %s%s%s%s%s%s%s%s{X\n\r",
wch->race < MAX_PC_RACE ? pc_race_table[wch->race].who_name
: " ",
wch->incog_level >= LEVEL_HERO ? "(Incog) " : "",
wch->invis_level >= LEVEL_HERO ? "(Wizi) " : "",
clan_table[wch->clan].who_name,
IS_SET (wch->comm, COMM_AFK) ? "[AFK] " : "",
IS_SET (wch->act, PLR_KILLER) ? "(KILLER) " : "",
IS_SET (wch->act, PLR_THIEF) ? "(THIEF) " : "",
wch->name, IS_NPC (wch) ? "" : wch->pcdata->title);
add_buf (output, buf);
}
}
sprintf (buf, "\n\rPlayers found: {R%d{w Immortals found : {R%d{w\n\r", nMatch, iMatch);
add_buf (output, buf);
page_to_char (buf_string (output), ch);
free_buf (output);
return;
}
---------------------------------------------------------
And thats it. Any help would be much appreciated!
USA #1
Don't forget to use the code tag. ;)

I don't think it's really possible. The size of the line buffer does not depend on the mud, it depends on the client the player is using. So the "center" would only depend on the client, which the mud can't read from.
#2
Alright, gotcha on that. My WHO currently looks like this.

**************************
Charmed


--=-=-=-= Mortals =-=-=-=--

[ Human ] Demitri the Pilferer

Players found: 1 Immortals found : 0

***************************

Now this is all aligned to the left side of my screen. Is there anyway I can edit it to make it look like its centered? Perhaps take away the [ Human ] thing next to the persons name? Thanks.