[Long][Code][newbie?] need help on mob func.

From: DJMC (dacain@netvisao.pt)
Date: 10/31/02


Hya,
I recently started to work on a mud
and i got to a point i cant seem to work it out
This function crashes the mud after a few minutes, somehow the more
logs i do in the func the faster it crashes.
Its an old version of circle maybe Bpl 9 not sure.

thanks for you help.
Daniel Correia

SPECIAL(goto_mayor)
{
   int goto_rooms[6] = { 13225, 13241, 13246, 13261, 13277, 13280 };
   int i = 0, j = 0;
   int location;
   int cmd_emote = find_command("emote");
   int cmd_mutter = find_command("mutter");
   int cmd_puke = find_command("puke");
   int cmd_say = find_command("say");
   int cmd_shudder = find_command("shudder");
   int cmd_sigh = find_command("sigh");
   int cmd_sway = find_command("sway");
   int cmd_whine = find_command("whine");
   int cmd_yell = find_command("yell");
   ACMD(do_action);
   ACMD(do_emote);
   ACMD(do_gen_com);
   ACMD(do_say);
   char  *move_messages[][2] = {
     { "The Mayor suddenly is no more.",
       "Suddenly the Mayor is right next to you." },
     { "POFF!!!",
       "POFF!!!" },
     { "A flaming rift opens up digesting the Mayor fully.",
       "Flames erupt out of nowhere leaving a slightly disoriented Mayor
behind." },
     { "There is a smoke remnant where the Mayor once stood.",
       "Stepping out of a smokescreen, that was not there a second ago,
is the local Mayor." },
     { "You hear a high pitched screech as the world is torn apart.",
       "Without any sound comes the Mayor walking from nowhere." },
     { "A thin bluish line passes through the room and when it is gone,
so is the Mayor.",
       "A thin bluish line passes through the room and when it is gone,
there is the Mayor." },
     { "You try to flee but a transspatial interference has already
passed by catching the Mayor.",
       "The world goes insane, shifting in colour and dimension. When it
stabilises, you have gained a Mayor." },
     { "A faint murmur, not from your belly this time, grows more tense
erupting in a roar swallowing the Mayor.",
       "You burp, unwillingly, and out jumps a slightly moist Mayor." },
     { "Suddenly a flash of light almost blinds you.",
       "The world grows dark as if all lanterns suddenly stopped
illuminating." },
     { "A soft female voice says 'It is time'",
       "A soft female voice says 'There you go'" },
     { "The ground leaps up and engulfs the Mayor in one piece.",
       "With an annoyed grumble the Mayor comes falling from above." },
     { "As a reversed ATM machine withdrawal the Mayor is sucked away.",
       "You hear a slight 'ka-sching' and from nowhere the Mayor
appears." },
     { "Gone, as a paycheque on pay-day, is the Mayor.",
       "Securely present, as a hangover the day after, is the Mayor." },
     { "The Mayor is disintegrated before your very eyes.",
       "The air starts to shimmer and from all the facettes a sturdy
little dwarf manifests." },
     { "A small hole no larger than a single gold coin appears and drags
the Mayor into it.",
       "What could have been an insect suddenly erupts disclosing a
fully living Mayor." }
   };

   // Random Dice Roll to see if moving
   if (number(1, 1000) < 900) {

     // Random Dice Roll to pick location
     i = number(0, 5);

     location = real_room(goto_rooms[i]);
     if (location < 0||location > top_of_world) {


       // Random Dice Roll to pick paired exit / entry messages
       j = number(0, 14);

       // If fighting then stop fighting
         if (FIGHTING(mob))
           stop_fighting(mob);

       // Outbound Message
       switch (number(0, 18)) {

       case 0:
         do_say(mob, "Oh No!", cmd_say, 0);
         do_say(mob, "It is happening again.", cmd_say, 0);
         break;
       case 1:
         do_say(mob, "LOOK OUT!  Behind you!  The rift is coming.",
cmd_say, 0);
         break;
       case 2:
         do_say(mob, "Excuse me.", cmd_say, 0);
         do_say(mob, "Yes you.", cmd_say, 0);
         do_emote(mob, "points at you.", cmd_emote, 0);
         do_say(mob, "Do you know anyhing about the space and time
continuum?", cmd_say, 0);
         do_say(mob, "Thought so.", cmd_say, 0);
         break;
       case 3:
         do_say(mob, "Wish I could bring you along.", cmd_say, 0);
         break;
       case 4:
         do_say(mob, "Why does this have to happen to me.", cmd_say, 0);
         break;
       case 5:
         do_say(mob, "Can you help me out.", cmd_say, 0);
         do_say(mob, "I would really like to have some help.", cmd_say,
0);
         break;
       case 6:
         do_say(mob, "Wonder if I may set the destination, for once.",
cmd_say, 0);
         break;
       case 7:
         do_say(mob, "Wonder if I may set the arrival date, for once.",
cmd_say, 0);
         break;
       case 8:
         do_say(mob, "Could you hold this for me?", cmd_say, 0);
         do_say(mob, "Asch, you already carry too much.", cmd_say, 0);
         do_say(mob, "Too late.", cmd_say, 0);
         break;
       case 9:
         do_say(mob, "Hurray, for once I am glad it come. ", cmd_say, 0);
         do_say(mob, "Now I do not have to look at you for a while.",
cmd_say, 0);
         break;
       case 10:
         do_say(mob, "Last time there was some beautiful longbearded
female dwarves where I ended up.", cmd_say, 0);
         do_say(mob, "Probably will not end up there again in a long
time...", cmd_say, 0);
         do_action(mob, 0, cmd_sigh, 0);
         break;
       case 11:
         do_say(mob, "I will kill that Glob!", cmd_say, 0);
         do_say(mob, "He did this to me you know.", cmd_say, 0);
         break;
       case 12:
         do_say(mob, "Beware of the Deep Gnomes!", cmd_say, 0);
         do_say(mob, "They are a really bad element of this town.",
cmd_say, 0);
         do_say(mob, "I am glad they keep themselves to the outskirts.",
cmd_say, 0);
         break;
       case 13:
         do_say(mob, "Ah, silence...", cmd_say, 0);
         break;
       case 14:
         do_action(mob, 0, cmd_mutter, 0);
         break;
       case 15:
         do_emote(mob, "goes all wobbly and wiggly all over his body.
Scary.", cmd_emote, 0);
         break;
       case 16:
         do_say(mob, "Try to catch me if you can.", cmd_say, 0);
         break;
       case 17:
         do_say(mob, "Sorry visitors.", cmd_say, 0);
         do_say(mob, "This is a private transportation.", cmd_say, 0);
         break;
       case 18:
         do_say(mob, "Did you remember to vote in the city elections?",
cmd_say, 0);
         break;

       default:
         break;
       }

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT