Roleplay Emotes --------------- Author: John "Noplex" Bellone Email: j.bellone@flipsidesoftware.com Website: http://www.flipsidesoftware.com/ Homepage: http://www.thealternate.org/ Statistics ---------- Created on: April 23rd, 2006 Last updated: April 24th, 2006 Codebase: SMAUG 1.7 FUSS Operating System: Ubuntu Dapper 6.06 (Debian) Compiler: GCC 4.0 Architecture: AMD64, Intel x86 Disclaimer ---------- This code has been tested on SMAUG 1.7 FUSS which can be found at the project's website[3] and has been built with GCC 4.0 running on a Debian based system. There is absolutely no guarentee that this code will run error-free on your setup. Be sure to follow the instructions carefully, and do not delete anything unless told to do so. Always, always, be sure to backup. You are not required to, but if any changes are made to the code it would be nice if you were to inform the author, or post an updated version on one of the many community websites. Thanks for using the code. Terms of Use ------------ (1) All method (function) descriptions must be left in place. (2) All file (header) descriptions must be left in place. (3) If a bug is found be sure to submit it to the SMAUG FUSS Project forums[4], or submit an email to the author. (4) This code is licensed under: Creative Commons Attribution-NonCommercial 2.5 License http://creativecommons.org/licenses/by-nc/2.5/ Overview -------- These two commands allow different approaches on emoting. The first forces the use of the character's name at least once inside the emote itself. This can either be done by utilizing the ACT function meta-character $n or by typing the name itself. If neither is done the output will append the character's name in brackets at the end. The second command outputs similar to the nameless above except you are thrown into an editor buffer instead of accepting a single line input. The idea for this came solely from the SMAUG 2.1 Realms of Despair[5] command. Instructions ------------ (1) act_comm.c Add the following code blocks to the bottom of the file: /* Summary: Allows for three different types of emoting utilizing * the ACT function's meta-character, the character's name, or by * appending the name at the end in brackets. * License: http://creativecommons.org/licenses/by-nc/2.5/ * Author: John "Noplex" Bellone (j.bellone@flipsidesoftware.com) */ void do_semote(CHAR_DATA* ch, char* argument) { if( IS_NPC(ch) ) { send_to_char( "Huh?\r\n", ch ); return; } if( argument[0] == '\0' ) { pager_printf_color( ch, "&G&YSyntax: semote [...]\r\n" "Syntax: semote [..$n..]\r\n" "Syntax: semote [..%s..]&g\r\n", ch->name ); return; } /* cleaning up the string a bit */ int len = strlen( argument ); if( argument[len-1] != '.') { argument[len] = '.'; argument[len+1] = '\0'; } /* utilizing the ACT $n meta-character */ if( strstr( argument, "$n" ) ) { act( AT_GREY, argument, ch, NULL, NULL, TO_ROOM ); act( AT_GREY, argument, ch, NULL, NULL, TO_CHAR ); return; } /* utilizing the character's name inside the emote */ else if( strstr( argument, ch->name ) ) { /* Only need to poll the descriptors because there is no point in sending * area echos to people that are switched or controlling NPCs */ DESCRIPTOR_DATA* d; for( d = first_descriptor; d; d = d->next ) if( d->character && d->character->in_room == ch->in_room ) { set_char_color( AT_GREY, d->character ); ch_printf( d->character, "%s\r\n", argument ); } return; } /* the name appending to the end of the string in brackets */ DESCRIPTOR_DATA* d; for( d = first_descriptor; d; d = d->next ) if( d->character && d->character->in_room == ch->in_room ) { set_char_color( AT_GREY, d->character ); ch_printf( d->character, "%s [%s]\r\n", argument, ch->name ); } } /* Summary: An extension to the nameless emote in the SEMOTE command. * This command throws the user into a buffer to type multi-lined text. * License: http://creativecommons.org/licenses/by-nc/2.5/ * Author: John "Noplex" Bellone (j.bellone@flipsidesoftware.com) * Credits: SMAUG 2.1 Realms of Despair (http://www.game.org/) */ void do_oemote(CHAR_DATA* ch, char* argument) { if( IS_NPC(ch) ) { send_to_char( "Huh\r\n", ch ); return; } char* buf; /* Going to need to add SUB_OEMOTE to the list of substates in mud.h */ switch( ch->substate ) { case SUB_RESTRICTED: set_char_color( AT_YELLOW, ch ); send_to_char( "You cannot use this from within another buffer.\r\n", ch ); return; case SUB_NONE: ch->substate = SUB_OEMOTE; ch->dest_buf = ch; start_editing( ch, buf ); return; case SUB_OEMOTE: buf = copy_buffer( ch ); stop_editing( ch ); if( buf[0] == '\0' ) { set_char_color( AT_YELLOW, ch ); send_to_char( "You need to type something in order to emote.\r\n", ch ); return; } break; } /* Only need to poll the descriptors because there is no point in sending * area echos to people that are switched or controlling NPCs */ DESCRIPTOR_DATA* d; for( d = first_descriptor; d; d = d->next ) if( d->character && d->character->in_room == ch->in_room ) { set_char_color( AT_GREY, d->character ); ch_printf( d->character, "%s [%s].\r\n", buf, ch->name ); } } (2) mud.h Find the list of substates (search for SUB_NONE) and add SUB_OEMOTE to the end of the active list (before SUB_TIMER_DO_ABORT). (3) Compile, and reboot/copyover. (4) cedit semote create cedit semote level 5 cedit oemote create cedit oemote level 5 Links ----- [1] Flipside Software http://www.flipsidesoftware.com/ [2] An Alternate Reality http://www.thealternate.org/ [3] SMAUG FUSS Project Website http://www.smaugfuss.org/ [4] SMAUG FUSS Project Forums http://forums.smaugfuss.org/ [5] SMAUG Project Website (Realms of Despair) http://www.game.org/