# # Patch name: look # Patch version: 1 # Author's name: Flame # Author's email: flame@kuwait.net # Version of PennMUSH: 168p1 # Date patch made: 11-09-1996 # Author is willing to support (yes/no): no # Patch format: diff -c # # # This is a contributed PennMUSH patch. Its use is subject to the # same restrictions found in PennMUSH's hdrs/copyrite.h file. # # No warranty is given for this patch. It is not necessarily going # to work on your system, with any version of PennMUSH other than # the one above, etc. # # If the author given above was willing to support the patch, you # should write to the author if you have any questions or problems. Do # *NOT* send email messages to Javelin or any PennMUSH mailing list about # this patch! # # Below this line is the author's description of the patch, # followed by the patch itself. If the patch is in context diff # format, you'll probably apply it by typing: patch < patchfile # in your top-level MUSH directory, unless instructed otherwise # below. # Okay, this patch containes my previous patches name-ntn and look-object-people. The reason i combined them is that i made update to name-ntn and didn't want to type the code again into original look.c and make the patch so this patch is directly from my look.c file... The update is ntn attribute contents are evaluated before being shown so now you can use all functions inside the attribute... like ansi() switch() ..etc i used it to make a clock like this: &ntn clock = ooO [time()] Ooo when you type look you will see: contents: clock(#23) ooO Wed Sep 11 19:05:21 1996 Ooo If you do really nice things, let me know :) *** src/look.orig Wed Sep 11 18:55:21 1996 --- src/look.c Wed Sep 11 19:07:39 1996 *************** *** 84,90 **** s1 = tbuf1; safe_chr(' ', tbuf1, &s1); strcpy(nbuf, Name(thing)); ! if ((p = strchr(nbuf, ';'))) *p = '\0'; safe_str(nbuf, tbuf1, &s1); if (Location(thing) == NOTHING) --- 84,90 ---- s1 = tbuf1; safe_chr(' ', tbuf1, &s1); strcpy(nbuf, Name(thing)); ! if ((p =(char *) strchr(nbuf, ';'))) *p = '\0'; safe_str(nbuf, tbuf1, &s1); if (Location(thing) == NOTHING) *************** *** 105,111 **** notify(player, tbuf1); } else { strcpy(nbuf, Name(thing)); ! if ((p = strchr(nbuf, ';'))) *p = '\0'; safe_str(nbuf, tbuf2, &s2); safe_str(" ", tbuf2, &s2); --- 105,111 ---- notify(player, tbuf1); } else { strcpy(nbuf, Name(thing)); ! if ((p =(char *) strchr(nbuf, ';'))) *p = '\0'; safe_str(nbuf, tbuf2, &s2); safe_str(" ", tbuf2, &s2); *************** *** 123,128 **** dbref loc; const char *contents_name; { dbref thing; dbref can_see_loc; /* check to see if he can see the location */ --- 123,132 ---- dbref loc; const char *contents_name; { + ATTR *b; + char const *s, *ap; + char tbuf1[BUFFER_LEN], *bp; + dbref thing; dbref can_see_loc; /* check to see if he can see the location */ *************** *** 137,142 **** if (can_see(player, thing, can_see_loc)) { /* something exists! show him everything */ notify(player, contents_name); DOLIST(thing, db[loc].contents) { if (can_see(player, thing, can_see_loc)) { notify(player, unparse_object(player, thing)); --- 141,147 ---- if (can_see(player, thing, can_see_loc)) { /* something exists! show him everything */ notify(player, contents_name); + notify(player, tprintf("People:")); DOLIST(thing, db[loc].contents) { if (can_see(player, thing, can_see_loc)) { if (Typeof(thing) == TYPE_PLAYER) *************** *** 139,145 **** notify(player, contents_name); DOLIST(thing, db[loc].contents) { if (can_see(player, thing, can_see_loc)) { ! notify(player, unparse_object(player, thing)); } } break; /* we're done */ --- 144,165 ---- notify(player, tprintf("People:")); DOLIST(thing, db[loc].contents) { if (can_see(player, thing, can_see_loc)) { ! if (Typeof(thing) == TYPE_PLAYER) ! { ! b = (ATTR *) atr_get_noparent(thing, "NTN"); ! if (b !=NULL) ! { ! s = (char *) uncompress(b->value); ! /* new hack: ntn processed */ ! ap = s; ! bp = tbuf1; ! process_expression(tbuf1, &bp, &ap, loc, player, player, PE_DEFAULT, PT_DEFAULT, NULL); ! *bp = '\0'; ! notify(player, tprintf("%s %s",unparse_object(player,thing),tbuf1)); ! } ! else ! notify(player, tprintf("%s",unparse_object(player,thing))); ! } } } notify(player, tprintf("Objects:")); *************** *** 142,147 **** notify(player, unparse_object(player, thing)); } } break; /* we're done */ } } --- 162,187 ---- } } } + notify(player, tprintf("Objects:")); + DOLIST(thing, db[loc].contents) { + if (can_see(player, thing, can_see_loc)) { + if (Typeof(thing) == TYPE_THING) + { + b = (ATTR *) atr_get_noparent(thing, "NTN"); + if (b !=NULL) + { + s = (char *) uncompress(b->value); + ap = s; + bp = tbuf1; + process_expression(tbuf1, &bp, &ap, loc, player, player,PE_DEFAULT, PT_DEFAULT, NULL); + *bp = '\0'; + notify(player, tprintf("%s %s",unparse_object(player,thing),tbuf1)); + } + else + notify(player, tprintf("%s",unparse_object(player,thing))); + } + } + } break; /* we're done */ } } *************** *** 319,324 **** } /* tell him the contents */ if (flag != 3) look_contents(player, loc, "Contents:"); if ((flag == 0) || (flag == 2)) look_exits(player, loc, "Obvious exits:"); --- 359,369 ---- } /* tell him the contents */ if (flag != 3) + #ifdef EXTENDED_ANSI + if (ShowAnsi(player)) + look_contents(player,loc,tprintf("%s%s%s",ANSI_YELLOW,"Contents:",ANSI_NORMAL)); + else + #endif look_contents(player, loc, "Contents:"); if ((flag == 0) || (flag == 2)) #ifdef EXTENDED_ANSI *************** *** 321,326 **** if (flag != 3) look_contents(player, loc, "Contents:"); if ((flag == 0) || (flag == 2)) look_exits(player, loc, "Obvious exits:"); } --- 366,376 ---- #endif look_contents(player, loc, "Contents:"); if ((flag == 0) || (flag == 2)) + #ifdef EXTENDED_ANSI + if (ShowAnsi(player)) + look_exits(player,loc,tprintf("%s%s%s",ANSI_YELLOW,"Obvious exits:",ANSI_NORMAL)); + else + #endif look_exits(player, loc, "Obvious exits:"); } *************** *** 322,328 **** look_contents(player, loc, "Contents:"); if ((flag == 0) || (flag == 2)) look_exits(player, loc, "Obvious exits:"); ! } void do_look_around(player) --- 372,378 ---- else #endif look_exits(player, loc, "Obvious exits:"); ! } void do_look_around(player)