/* all i ask for this snippet is credit in the help file. something like History and lookhist by taka taka@ghostmud.com that would be enough credit for me. As always it is nice to know someone uses my snip you could email me if you like but not required. */ Add this in Interp.h DECLARE_DO_FUN( do_history ); DECLARE_DO_FUN( do_lookhist ); Add this to Interp.C { "history", do_history, POS_SLEEPING, 0, LOG_NORMAL, 1 }, { "lookhist", do_lookhist, POS_SLEEPING, 0, LOG_NORMAL, 1 }, In Save.c Find void fwrite_char( CHAR_DATA *ch, FILE *fp ) and add this inside it if (ch->pcdata->history[0] != '\0' ) fprintf( fp, "Hist %s~\n", ch->pcdata->history ); Find bool load_char_obj( DESCRIPTOR_DATA *d, char *name ) and add this in the initialize area ch->pcdata->history = str_dup( "" ); Find void fread_char( CHAR_DATA *ch, FILE *fp ) and add under CASE 'H': KEYS( "Hist", ch->pcdata->history, fread_string( fp ) ); In MERC.H add this in the pcdata structure char * history; Add this to the bottom of act_info.c /* * Allows PC to make and store a history. * by TAKA * (c) 1999 TAKA of the Ghost Dancer MUD Project */ void do_history( CHAR_DATA *ch, char *argument ) { char buf[MSL], arg[MIL]; if ( argument[0] != '\0' ) { buf[0] = '\0'; smash_tilde( argument ); if (argument[0] == '-') { int len; bool found = FALSE; if (ch->pcdata->history == NULL || ch->pcdata->history[0] == '\0') { send_to_char("No lines left to remove.\n\r",ch); return; } strcpy(buf,ch->pcdata->history); for (len = strlen(buf); len > 0; len--) { if (buf[len] == '\r') { if (!found) /* back it up */ { if (len > 0) len--; found = TRUE; } else /* found the second one */ { buf[len + 1] = '\0'; free_string(ch->pcdata->history); ch->pcdata->history = str_dup(buf); send_to_char( "Your history is:\n\r", ch ); page_to_char( ch->pcdata->history ? ch->pcdata->history : "(None).\n\r", ch ); return; } } } buf[0] = '\0'; free_string(ch->pcdata->history); ch->pcdata->history = str_dup(buf); send_to_char("{RHistory cleared.{x\n\r",ch); return; } if ( argument[0] == '+' ) { if ( ch->pcdata->history != NULL ) strcat( buf, ch->pcdata->history ); argument++; while ( isspace(*argument) ) argument++; } argument = one_argument( argument, arg ); smash_tilde( argument ); if ( !str_cmp( arg, "write") ) { if ( argument[0] == '\0' ) string_append( ch, &ch->pcdata->history ); return; } if ( strlen(buf) >= 4096) { send_to_char( "History too long.\n\r", ch ); return; } strcat( buf, argument ); strcat( buf, "\n\r" ); free_string( ch->pcdata->history ); ch->pcdata->history = str_dup( buf ); } send_to_char( "Your history is:\n\r", ch ); page_to_char( ch->pcdata->history ? ch->pcdata->history : "(None).\n\r", ch ); return; } void do_lookhist( CHAR_DATA *ch, char *argument ) { char arg1[MIL]; CHAR_DATA *victim; argument = one_argument (argument, arg1); if (arg1[0] == '\0') { stc ("{rWhos history do you want to read?{x\n\r", ch); return; } if ((victim = get_char_world (ch, arg1)) == NULL) { stc ("{rThey aren't here.{x\n\r", ch); return; } stc( "Thier history is:\n\r", ch ); page_to_char( victim->pcdata->history ? victim->pcdata->history : "(None).\n\r", ch ); return; } Put in HELP.ARE -1 HISTORY LOOKHIST~ Syntax: history Syntax: history + Syntax: history - Syntax: history write This {GHISTORY{x command works exactly the same way as the description command. The History command will allow you to enter a detailed history or background for your character. It can be up to twice the size of your description. Using the {C+ sign{x will add lines of text to your history and using the {C- sign{x will remove lines of text from your history. The history command by itself will show you your current history. To view any other players history, use the lookhist command. Syntax: LOOKHIST Looks at the history of another player. History and LookHistory by Taka taka@ghostmud.com ~