TG's GMOTE Code Snippet
About This Code
This GMOTE implementation was written by Trellan and recovered from an archived copy of the Dawn of Time forums. The original publication date is unknown.
GMOTE, originally called godmote, is an expanded emote command that supports multiple character, mobile, and object targets within a single command.
Character and mobile targets are identified with an
@ symbol, while object targets
are identified with a
# symbol.
An asterisk can be used to position the acting character's name
somewhere other than at the beginning of the emote.
Example command:
gmote slaps @timbo with #glove, then turns to @frieda
and offers her #tea.
Archival Notice
This code has been preserved for reference. The archived version contains damaged formatting, typographical errors, and curly quotation marks introduced during copying. It may require correction before it will compile in a modern or modified Dawn of Time codebase.
GMOTE Source Code
Download Code
/*************************************************************************** * The Dawn of Time v1.69s.beta4 (c)1997-2007 Michael Garratt * * >> A number of people have contributed to the Dawn codebase, with the *
* majority of code written by Michael Garratt – www.dawnoftime.org *
* >> To use this source code, you must fully comply with all the licenses * * in licenses.txt... In particular, you may not remove this copyright * * notice. * *************************************************************************** * >> Original Diku Mud copyright (c)1990, 1991 by Sebastian Hammer, * * Michael Seifert, Hans Henrik Staerfeldt, Tom Madsen, & Katja Nyboe. * * >> Merc Diku Mud improvements copyright (C) 1992, 1993 by Michael * * Chastain, Michael Quan, and Mitchell Tse. * * >> ROM 2.4 is copyright 1993-1995 Russ Taylor and has been brought to * * you by the ROM consortium: Russ Taylor(rtaylor@pacinfo.com), * * Gabrielle Taylor(gtaylor@pacinfo.com) & Brian Moore(rom@rom.efn.org) * * >> Oblivion 1.2 is copyright 1996 Wes Wagner * **************************************************************************/ /**************************************************************************/ void do_godmote(char_data *ch, char *argument) { char_data *to; char_data *victim; char_data *vics[10]; OBJ_DATA *obj; char fullresult[MSL]; char name[MIL]; char myresult[MSL]; char *original; char *letter; char *point; char mybuf[MSL]; char *j = NULL; char *str; int i = 0; bool blind; myresult[0] = ‘\0'; name[0] = ‘\0'; mybuf[0] = ‘\0′; for (i = 0;iprintln(“What would you like to godmote?”); return; } if (count_char(argument,'@') > 10){ ch->println(“There is a limit of 10 targetable people in a godmote.”); return; } if (count_char(argument,'@') > 0 && count_char(argument,'*') > 0 && strstr(argument,”@”) < strstr(argument,”*”)){ ch->println( “The * must appear before the @.” ); return; } if(check_defrauding_argument(ch, argument)){ return; } //first, process for people and objects point = mybuf; if (count_char(argument,'*') < 1){ sprintf(myresult,”$C %s”,argument); //put the char at the beginning strcpy(argument,myresult); } letter = argument; i = 0; while ( *letter != ‘\0' ) { name[0] = ‘\0'; if( *letter != ‘@' && *letter != ‘#' && *letter != ‘*') { *point++ = *letter++; continue; } switch ( *letter ) { //at this point, it's @,#, or * case ‘*': j = “$C”; break; case ‘#': //object letter++; while (*letter != ‘ ‘ && *letter != ‘,' && *letter != ‘.' && *letter != ‘\0') { strncat(name,letter,1); letter++; } if ((obj = get_obj_here(ch,name)) == NULL){ ch->println(“One of those objects isn't here.”); return; } j = FORMATF(“%s”,obj->short_descr); letter–; break; case ‘@': letter++; while (*letter != ‘ ‘ && *letter != ‘,' && *letter != ‘.' && *letter != ‘\0') { strncat(name,letter,1); letter++; } if ((victim = get_char_room(ch,name)) == NULL){ ch->println(“One of those people aren't here.”); return; } vics[i] = victim; j = FORMATF(“$%d”,i); letter–; i++; break; } ++letter; while ( ( *point = *j ) != ‘\0' ) { ++point, ++j; } } *point = ‘\0'; //ok, We have all of our objects in, and a $ for each victim //now loop through people in the room and PERS the sentences strcpy(fullresult,mybuf); for ( to = ch->in_room->people;to ;to = to->next_in_room ) { blind = false; if (to == ch){ continue; } if (!can_see(to,ch)){ continue; } blind=(IS_AFFECTED( to, AFF_BLIND ) || is_affected( to, gsn_blindness )); if (blind){ continue; } if (!IS_AWAKE(to)){ continue; } //process point = mybuf; original = (char*)fullresult; str = original; while ( *str != ‘\0' ) { if( *str != ‘$' ) { *point++ = *str++; continue; } ++str; j = (char*)” “; switch ( *str ) { default: j = “”; break; case ‘C': j = PERS(ch,to); break; case ‘$': j =(char*)”$”; break; case ‘0': if (vics[0] == to){ j = “you”; }else j = PERS(vics[0],to); break; case ‘1': if (vics[1] == to){ j = “you”; }else j = PERS(vics[1],to); break; case ‘2': if (vics[2] == to){ j = “you”; }else j = PERS(vics[2],to); break; case ‘3': if (vics[3] == to){ j = “you”; }else j = PERS(vics[3],to); break; case ‘4': if (vics[4] == to){ j = “you”; }else j = PERS(vics[4],to); break; case ‘5': if (vics[5] == to){ j = “you”; }else j = PERS(vics[5],to); break; case ‘6': if (vics[6] == to){ j = “you”; }else j = PERS(vics[6],to); break; case ‘7': if (vics[7] == to){ j = “you”; }else j = PERS(vics[7],to); break; case ‘8': if (vics[8] == to){ j = “you”; }else j = PERS(vics[8],to); break; case ‘9': if (vics[9] == to){ j = “you”; }else j = PERS(vics[9],to); break; } ++str; while ( ( *point = *j ) != ‘\0' ) { ++point, ++j; } } *point = ‘\0'; //fully processed to->record_replayroom_event(mybuf); to->println(mybuf); } //display it to the ch now... char mybuf2[MSL]; mybuf2[0] = ‘\0'; point = mybuf2; original = (char*)fullresult; str = original; while ( *str != ‘\0' ) { if( *str != ‘$' ) { *point++ = *str++; continue; } ++str; j = (char*)” “; switch ( *str ) { default: j = “”; break; case ‘C': j = PERS(ch,ch); break; case ‘$': j =(char*)”$”; break; case ‘0': j = PERS(vics[0],ch); break; case ‘1': j = PERS(vics[1],ch); break; case ‘2': j = PERS(vics[2],ch); break; case ‘3': j = PERS(vics[3],ch); break; case ‘4': j = PERS(vics[4],ch); break; case ‘5': j = PERS(vics[5],ch); break; case ‘6': j = PERS(vics[6],ch); break; case ‘7': j = PERS(vics[7],ch); break; case ‘8': j = PERS(vics[8],ch); break; case ‘9': j = PERS(vics[9],ch); break; } ++str; while ( ( *point = *j ) != ‘\0' ) { ++point, ++j; } } *point = ‘\0'; ch->record_replayroom_event(mybuf2); ch->println(mybuf2); //mudprog triggers if (!IS_NPC(ch) && !IS_SWITCHED(ch)) { char_data *mob; for (mob = ch->in_room->people ; mob ; mob = mob->next_in_room ) { if(!IS_NPC(mob)){ continue; } if (HAS_TRIGGER( mob, MTRIG_ACT )){ if(HAS_TRIGGER( mob, MTRIG_ACT )){ mp_act_trigger( mybuf2, mob, ch, NULL, NULL, MTRIG_ACT ); } } } } return; }
Installation Notes
The command must be added to the appropriate Dawn of Time command files before it can be used.
-
Add the command declaration to
interp.h. -
Add the command entry to
interp.cpp. - Place the function in an appropriate source file.
- Replace the damaged curly quotes with normal C++ quotation marks before compiling.
- Review the snippet for compatibility with your version of the Dawn of Time codebase.
Tirradyn provides this archived snippet for preservation and reference purposes and cannot guarantee compatibility or provide installation support.