quote.txt
snippets · 1.7 KB · 2010-03-30
Quote at logoff: a random quote when you quit (a BBS-days idea).
Download « Back to the snippets list
Just had a flashback to my BBS days and decided a random quote would
be better at log off than the same old same old.... hence this
code... If you use it, remember to credit me in your credits blah
blah... On my mud, I added color codes to the do_quote routine...
If anyone does up code to make this work online with OLC, send it
my way why doncha?
Comments/Criticisms/Improvements should be sent to
elfren@aros.net...
For Random Quotes on your Mud, add the following stuff.
:--add to merc.h-- (almost anywhere will work)
#define MAX_QUOTES 2 /* This must equal the # of quotes you have */
: in act_comm.c, somewhere before the lines:
> act( "$n has left the game.", ch, NULL, NULL, TO_ROOM );
> sprintf( log_buf, "%s has quit.", ch->name );
> log_string( log_buf );
: will be the quit message.. this varies greatly between muds,
: and often notify messages will be between it and those three lines.
: delete that send_to_char statment and add the following:
do_quote (ch);
:following goes in act_comm.c
/*
* Structure for a Quote
*/
struct quote_type
{
char * text;
char * by;
};
/*
* The Quotes - insert yours in, and increase MAX_QUOTES in merc.h */
const struct quote_type quote_table [MAX_QUOTES] =
{
{ "Cogito Ergo Sum", "Descartes" }, /* 1 */
{ "Tell Your Local Imm To Make More Quotes", "Lotherius" }
};
/*
* The Routine
* Quote Code is by elfren@aros.net
*/
void do_quote( CHAR_DATA *ch )
{
char buf[MAX_STRING_LENGTH];
int number;
number = number_range( 0, MAX_QUOTES);
sprintf ( buf, "\n\r%s\n\r - %s\n\r",
quote_table[number].text,
quote_table[number].by);
send_to_char ( buf, ch );
return;
}