autotick1.txt
snippets · 5.2 KB · 2010-03-30
Autotick snippet by Praesius (Shardscape MUD): shows messages defined in the tick_table to everyone connected.
Download « Back to the snippets list
/***************************************************************************
* This snippet written by Praesius of Shardscape MUD. *
* *
* This snippet is a quick way to have messages defined in tick_table *
* display to everyone connected to the mud. You can define as many *
* messages in the tick_table as you want. I'm sure there's a cleaner *
* way to do this, but this was the easiest way I could think of. *
* *
* You don't have to bother crediting me, but I would at least like *
* an email letting me know that you're using it. *
* *
* This snippet was inspired by the post by Aydrian on MudMagic.com *
* explaining how to add tick messages. I just expanded on that idea. *
* *
* Also, this code can be written as a function "show_autotick" or *
* or something similar to make it toggle-able via an autotick cmd. *
**************************************************************************/
/***************************************************************************
* Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer, *
* Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe. *
* *
* Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael *
* Chastain, Michael Quan, and Mitchell Tse. *
* *
* In order to use any part of this Merc Diku Mud, you must comply with *
* both the original Diku license in 'license.doc' as well the Merc *
* license in 'license.txt'. In particular, you may not remove either of *
* these copyright notices. *
* *
* Much time and thought has gone into this software and you are *
* benefitting. We hope that you share your changes too. What goes *
* around, comes around. *
***************************************************************************/
/***************************************************************************
* ROM 2.4 is copyright 1993-1998 Russ Taylor *
* ROM has been brought to you by the ROM consortium *
* Russ Taylor (rtaylor@hypercube.org) *
* Gabrielle Taylor (gtaylor@hypercube.org) *
* Brian Moore (zump@rom.org) *
* By using this code, you have agreed to follow the terms of the *
* ROM license, in the file Rom24/doc/rom.license *
***************************************************************************/
/*****************************************************
* merc.h *
* In global constants, add the following. *
****************************************************/
extern char *const tick_table[];
/*****************************************************
* const.c *
* Add the following table. You can add as many *
* messages as you want to this table. *
****************************************************/
char *const tick_table[] =
{
"TICK!",
"TICK!",
NULL
};
/*****************************************************
* update.c *
* under the line 'static int pulse_music;' *
* add the following *
****************************************************/
static int count;
/****************************************************************
* under the line *
*'wiznet("TICK!",NULL,NULL,WIZ_TICKS,0,0);' *
* add the following *
***************************************************************/
DESCRIPTOR_DATA *d;
for (count = 0; tick_table[count]; count++);
for (d = descriptor_list; d != NULL; d = d->next)
{
if (d->connected == CON_PLAYING && !IS_NPC (d->character))
send_to_char(tick_table[number_range(0, count - 1)], d->character );
}
/*****************************************************************
* That's it! Clean compile and reboot/copyover, and you should *
* see a random message from the table on every tick *
* *
* Praesius, *
* spiffster@owbn.org *
* Shardscape MUD *
* frostmud.dyndns.org port 8052 *
****************************************************************/