Author Topic: emote.c  (Read 2066 times)

marajin

  • Guest
emote.c
« on: September 21, 2006, 01:03:55 PM »
This is an updated version of emote.c for DeadSouls 2.1

This version now does what the old version's "help emote" said it could:

"Non-avatars lose a stamina point for each emote to discourage abuse."
code:

/*    /cmds/players/emote.c
 *    from the Dead Souls LPC Library
 *    for those times when you are feeling emotional
 *    created by Descartes of Borg 950412
 */

#include <lib.h>

inherit LIB_DAEMON;

mixed cmd(string args) {
    if( !creatorp(this_player()) && !avatarp(this_player()) ) {
   if( (int)this_player()->GetStaminaPoints() < 1 )
       return "You are too tired.";
    }

    if( !creatorp(this_player()) && !avatarp(this_player()) ) {
   if( (int)this_player()->GetStaminaPoints() > 0 )
        this_player()->AddStaminaPoints(-1);
   }

    if( !args || args == "" ) {
   message("my_action", "You are feeling emotional.", this_player());
   message("other_action", (string)this_player()->GetName() +
     " looks emotional.", environment(this_player()),
     ({ this_player() }));
   return 1;
    }
    if( args[0] != '\'' ) args = " " + args;
    message("my_action", "" + (string)this_player()->GetName() +
      args, this_player());
    message("other_action", (string)this_player()->GetName() + args,
      environment(this_player()), ({ this_player() }) );
    return 1;
}

string GetHelp(string str) {
    return ("Syntax: <emote MESSAGE>\n"
    "        <:MESSAGE>\n\n"
    "Places any message you specify directly after your name. For "
    "example, \"emote smiles.\" would have others see "
    "\"Descartes smiles.\". Non-avatars lose a stamina point for "
    "each emote to discourage abuse.\n\n"
    "See also: feelings.");
}
Replace the code in /cmds/players/emote.c with this code, then update /cmds/players/emote.c