Play Now! (tgmud.net port 9010) Vote (MudVerse)
Vote (TMC) Discord
Facebook
Reddit Downloads
Events
Rules
Staff List Character Creation
Character Pictures
History
Races
Classes
Empires
The Gathering... | GMOTE Snippet

TG's GMOTE Code Snippet

Notes: Code by Trellan. Taken from an Archival copy of Dawn of Time's Forum. Date unknown.

I call it godmote, or gmote for short. It basically replaces every other mote type, including the ones I've created in the past for moting with objects. With this mote type, you can emote with up to 10 target people/mobs at once, along with unlimited objects, all in one mote command. Ok, I might be exagerating about unlimited objects, you're limited by he MSL limit in the processing variables, but 8192 characters should be enough for a number of people and objects I think. To use it, simply include the people/objects inline with the command, preceding people with @ and objects with #. For instance.... gmote slaps @timbo with #glove, then turns to @frieda and offers her #tea. People will be shoved through the PERS function so that they will display properly to people in the room, and objects will be replaced with their short descriptions. It also supports usage of * to replace your name somewhere other than the beginning if you like, as smote and amote do. On to the code...

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; }

And that's it. Don't forget to add godmote, gmote, or both, however you want to call it, to your interp.cpp and interp.h files as you do with all new commands.