Re: Longterm Time format

From: Mark A. Heilpern (heilpern@MINDSPRING.COM)
Date: 08/18/98

At 12:28 PM 8/18/98 -0400, you wrote:
>I want it to display a msg every minute and 10
>seconds "You animate the corpse. <so much> time left." or "You enchant the
>armor. <so much> time left." etc, but this is difficult to do in the current
>form I have it. Any suggestions?

Sounds like you want an event system to me. I'm not familiar with
most of the event packages out there, but they typically let you associate
a variable with your event structure. This variable can be a pointer to
a structure with as much information as you need. For delayed spell
casting, you could consider a structure such as:

struct delayed_spell_event_info {
    int number_of_pulses_left;
    struct char_data *ch, *vict;
    struct obj_data *tobj;
    int spell_num;

And a delayed function that, in PSEUDO-code, resembles:

void delayed_spell_event_func(struct delayed_spell_event_info *info)
    if (--info->number_of_pulses_left) {
        sprintf(buf, "There are %d pulses remaining for the spell.\r\n",
        send_to_char(buf, info->ch);
        /* re-initialize the event with this new structure */
        add_event(info, delayed_cast_spell_event_func,
    } else  cast_spell(info->ch, info->vict, info->tobj, info->spell_num);
 /* finally cast it */

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

This archive was generated by hypermail 2b30 : 12/15/00 PST