Re: [CODE] [NEWBIE] Non-instantaneous commands

From: Stephen Wolfe (siv@CYBERENET.NET)
Date: 08/07/98


> try wait_state

um..no..wait state creates a delay between when character commands are
interpreted by the mud..ie, a character cannot execute another command
until the wait state is up..what Urion wants is an event system..get
dg_events off of the ftp site, then you can create an event like so:


struct hw_obj
{
  struct char_data *ch;
};

ACMD(hello_world)
{
  struct hw_obj *hw;

  send_to_char("Hello\r\n", ch);

  CREATE(hw, struct hw_obj, 1);
  hw->ch = ch;
  add_event(2, world, hw);
}

EVENT(world)
{
  struct hw_obj *hw = (stryuct hw_obj *) event_object;

  send_to_char("World\r\n", hw->ch);

  free(hw);
}

that's basically the format for events..i use them as replacements for all
of the loops like erwin posted a while ago..and all of that other good
stuff..

uh..needless to say, that was all psuedo code that may not work depending
on the actual format of the dg_event package (i extracted parts of it from
the original dg code before this patch was avaiable, so i don't think mine
matches)..

siv


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



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