From: Erik Niese-Petersen Subject: Re: [Circle] who2html 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] ==================================================================== Ok. I made two minor corrections to Erik's code, and tested it under 30bpl11. Works like a champ. I put all this in comm.c, since it seemed easiest. Add the following lines where shown, then place the main code (Erik's + changes) at the very bottom. As applied, it will update every 30 seconds. -- BuckFloyd@aol.com ==================================================================== void check_idle_passwords(void); void heartbeat(int pulse); void make_who2html(void); <-- Add <... skip down a ways ...> if (descriptor_list == NULL) { log("No connections. Going to sleep."); make_who2html(); <-- Add <... skip down a ways...> if (!(pulse % PULSE_VIOLENCE)) perform_violence(); if (!(pulse % (30 * PASSES_PER_SEC))) <-- Add make_who2html(); <-- Add <...Now, add this to the end/bottom...> void make_who2html(void) { extern struct descriptor_data *descriptor_list; extern char *class_abbrevs[]; FILE *opf; struct descriptor_data *d; struct char_data *ch; if ((opf = fopen("~/public-html/mud.tmp", "w")) == 0) return; /* or log it ? *shrug* */ fprintf(opf, "Who is on the Mud?\n"); fprintf(opf, "

Who is playing right now?


\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), CLASS_ABBR(ch), GET_NAME(ch), GET_TITLE(ch)); fprintf(opf, buf); } } else fprintf(opf,"Apparently, nobody is logged on at the moment..."); fprintf(opf, "
\n"); fclose(opf); system("mv ~/public-html/mud.tmp ~/public-html/mud.html &"); }