Pager [by Murmix]
Snippet Posted Wednesday, August 12th @ 11:32:49 PM, by George Greer in the Specials dept.
Added May 30, 1997. Click the link below to read it or download it.

From: Murmix <daniel@tellus.scala.se>
Subject: Pager spec_proc for mortals

Hello,

  I don't know if this has been done before, but I took the time
to write a spec_proc so mortals would be allowed to use page
from a special Paging Room in the starting bar( emmm, zone). =)
  Also, there is a random little commercial line with every page
which I thought could be quite fun...

  The reason why I send this to the list is that I'm still quite
unexperienced in c coding - I put together the spec_proc using
the two skills "Cut & Paste" and "Look & do similarly".

I would be very grateful if someone who knows c better than I do
could point at any errors or something bad that I've done in this.

And, of course feel free to use it in your mud if you dare
to trust me...You really shouldn't  :)
Please send me a little mail if you do use it - so I can feel
a little proud ...

Enough talk, here comes the code:

********************** C O D E   S T A R T *************************

// Commercial lines, used in the pager spec_proc.
// Created 1997-05-27 by DM

const char *commercials[] =
{
   "Testing random messages1!", // Note: These messages must be
   "Testing random messages2!", // exactly 25 characters long
   "Testing random messages3!"  // not counting colour codes.
};

#define NUMBER_OF_COMMERCIALS 3 // Change here if you add commercials!

SPECIAL(pager) /* 1997-May-27 by DM */
{
    ACMD(do_page);

    struct char_data *vict;
    int r;

    if (!CMD_IS("page"))

return FALSE;

    send_to_char("\n\r§R***#N#c The Floating Vagabond Pager Service - "
                 "development version #N#R***#N\n\r", ch);

    if (GET_LEVEL(ch) < level_can_shout) {

sprintf(buf1, "§R***#N#c Sorry. You must be at least level %d to "
                      "use this service!  #N#R***#N\n\r",

level_can_shout);

send_to_char(buf1, ch);

return TRUE;
    }

    if (!*arg) {

send_to_char("§R***#N#c You must supply a name. Whom do you wish "
                     "to page??  #N#R***#N\n\r", ch);

return TRUE;
    }

    half_chop(arg, buf, buf2);

    if ((vict = get_char_vis(ch, buf))) {

/* First the message we send to the pagee/victim. */




send_to_char("\n\r§R***#N#c The Floating Vagabond Pager Service - "
                     "development version #N#R***#N\n\r", vict);

sprintf(buf, "\007\007§R*** %22s wants your attention! ***\n\r",
                GET_NAME(ch));

send_to_char(buf, vict);


r = (number(0, (NUMBER_OF_COMMERCIALS - 1))); //Picks a random number




sprintf(buf, "§R***#N#c This message was sponsored by <%s>"
                     "#N#R***#N\n\r", commercials[r]);

send_to_char(buf, vict);




/* Then what we send to the pager/character */




sprintf(buf, "\007\007§R***#N#c The page has successfully been "
                     "delivered to #N#G%13s #N#R***#N\n\r", GET_NAME(vict));

send_to_char(buf, ch);

return TRUE;
    } else

send_to_char("§R***#N#c There is no person with such name in the "
                     "game! Try again! #N#R***#N\n\r", ch);



return TRUE;

}
********************** C O D E   E N D ***************************

Best Regards and thank you all,
Murmix
(aka "Mogwai of the Floating Vagabond")


<< Online Xname Command [by David Endre] | Reply | View as text | Flattened | Peace Command [by ?] >>

 


Related Links
  download
Related Articles
More by greerga
 
 

CircleMUD Snippets
 
Note: Not all of these snippets will work perfectly with your version of code, so be prepared to fix one or two bugs that may arise, and please let me know what you needed to do to fix it. Sending a corrected version is always welcome.
Finally, if you wish to use any of the snippets from this page, you are more than welcome, just mention the authors in your credits. If you wish to release any of these snippets to the public on another site, contact me FIRST.