Re: [CODE] [MOBPROGS] Wait_Prog

From: ;P (siv@CYBERENET.NET)
Date: 04/14/98


> I was wondering. Have anyone done any code for the mobprogs so that there
> can be a pause between each command in a trigger?

first of all..get an event system (i'd recommend dg_events from the ftp
site), then setup a mob command that will create delayed command
events..here's one that i adapted from something available from the
sites..note that these are only for example, and anything you make will
have to be tweaked for your event system..there's also an example mob prog
at the bottom..

siv

struct mpdelay_event_obj {
  struct char_data *ch;
  long info;
};

EVENT(delayed_command)
{
  struct mpdelay_event_obj *ev_o = (struct mpdelay_event_obj *) event_object;

  command_interpreter(ev_o->ch, (char *) ev_o->info);
  FREE((char *) ev_o->info);
  FREE(ev_o);
}

ACMD(do_mpdelayed)
{
  char arg1[20];
  int delay;
  struct mpdelay_event_obj *mpdelay_obj;

  arg1[0] = '\0';

  if (!IS_NPC(ch) || IS_AFFECTED(ch, AFF_CHARM) || ch->desc) {
    send_to_char("Huh?\n\r", ch);
    return;
  }
  half_chop(argument, arg1, buf);
  delay = atoi(arg1);

  if (!delay) {
    sprintf(buf1, "Mpdelayed - the delay is invalid. - vnum #%d",
        mob_index[ch->nr].virtual);
    log_info(buf1);
  } else {
    CREATE(mpdelay_obj, struct mpdelay_event_obj, 1);
    mpdelay_obj->ch = ch;
    mpdelay_obj->info = (int) str_dup(buf);
    delay *= PASSES_PER_SEC;
    add_event(delay, delayed_command, mpdelay_obj, ch);
  }
}

#3061
janitor man elderly~
an elderly janitor~
A tired looking elderly janitor is here cleaning up what he can.
~
A small man wearing earthy sandles and a thin cloth shirt wanders around
picking up the trash that everyone leaves behind.
An old man wearing torn sandals and a gray smock wanders around the
town cleaning up messes wherever he may come across them.
~
2121 0 800 E
1 20 9 2d6+10 1d5+0
34 100 0
10 10 1
E
>rand_prog 1~
say What the hell am I doing?
mpdelay 3 say I pick up other people's shit all day...
mpdelay 5 say What the fuck is wrong with me?
~
>rand_prog 2~
mpecho The elderly janitor sits on the ground dejectedly.
mpdelay 1 sob
mpdelay 3 say  I hate this job... someone kill me...
mpdelay 4 sob
mpdelay 6 say Please... end this pain...
~
>rand_prog 3~
say This must be the shittiest job in the world.
~
>rand_prog 4~
say This is bullshit... why can't players pick up their own shit?
mpdelay 2 say Fucking newbie vests... pieces of meat.. why don't they junk this shit?
~
|


     +------------------------------------------------------------+
     | 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