On Mon, 5 Aug 1996, Cyber Reaper wrote:
> before I make it has anyone made an snippet to port who to a HTML file so
> that people at your web page can see who is on at the moment. if not could I
> get a few pointers. first where would I put it so that it is updated say...
> once every 30 seconds, second, what command is used to write to an ansii
> file? I know the command to read, but not write. thank you.
Here is a fast example.. Not sorted. Show mortals and all immortal
who are not invis..
[NOT tested! So typos and other bugs.. Blame me.. :) But it give you an
idea ]
void make_who2html(void) {
extern struct descriptor_data *descriptor_list;
FILE *opf;
struct descriptor_data *d;
struct char_data *ch;
if ((opf = fopen("~/public_html/who_on_mud.tmp", "w")) == 0)
return; /* or log it ? *shrug* */
fprintf(opf, "<HTML><HEAD><TITLE>Who is on the MUD?</TITLE></HEAD>\n");
fprintf(opf, "<BODY><H1>Who play right now?</H1><HR>\n");
for(d = descriptor_list; d; d = d->next)
if(!d->connected) {
if(d->original)
ch = d->original;
else if (!(ch = d->character)
continue;
if(GET_LEVEL(ch) < LVL_IMMORT || (GET_LEVEL(ch)>=LVL_IMMORT &&
!GET_INVIS_LEV(ch))) {
sprintf(buf, "[%2d %s] %s %s\n", GET_LEVEL(ch), GET_ABBR(ch),
GET_NAME(ch), GET_TITLE(ch));
fprintf(opf, buf);
}
}
fprintf(opf, "<HR></BODY></HTML>\n");
fclose(opf);
system("mv ~/public_html/who_on_mud.tmp ~/public_html/who_on_mud.html &");
}
Hope it helps.
---
Erik Niese-Petersen
Aka Quint The typo God
Realms of Darkness IMP [matrix.xiii.com 6666. Playertesting]
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://cspo.queensu.ca/~fletcher/Circle/list_faq.html |
+-----------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/07/00 PST