who name

Posted by Ithildin on Wed 19 May 2004 02:40 AM — 8 posts, 26,744 views.

USA #0
ok, so i'm droppin the note thing for a little bit and starting on something else. i just won't be writing notes for awhile...heh.

ok, what i have done now is this:

i have put color into my name on the who list. i made an extra line for my saved file to include color. the problem is when i save it overrides the actual name to have the color. example:

Name Ithildin~
Namewho &cIthildin~

before i save.

Name &cIthildin~
Namewho &cIthildin~

after i save.

i know what i'm doing wrong, i just don't know how to fix it. here's the code.



in fwrite:

fprintf( fp, "Name         %s~\n",	ch->name		);
	fprintf( fp, "Namewho      %s~\n",	ch->name		);

in fread:

	    KEY ("Name", ch->name, fread_string( fp ) );
		KEY ("Namewho", ch->name, fread_string( fp ) );


now i know the ch->name is what i'm wanting to fix. i don't know how to add a ch->namewho. i'm just having a brain fart right now. anyone know what to do?

USA #1
What's wrong with just adding a char * namewho to the char_data struct?
USA #2
well i did that...and it crashes my mud.


Wed May 19 00:20:56 2004 :: [*****] FILE: ../player/i/Ithildin LINE: 325
Wed May 19 00:20:56 2004 :: [*****] BUG: Fread_char: no match: i3perm
Wed May 19 00:20:56 2004 :: [*****] FILE: ../player/i/Ithildin LINE: 325
Wed May 19 00:20:56 2004 :: [*****] BUG: Fread_char: no match: 5
Wed May 19 00:20:56 2004 :: [*****] FILE: ../player/i/Ithildin LINE: 326
Wed May 19 00:20:56 2004 :: [*****] BUG: Fread_char: no match: i3flags
Wed May 19 00:20:56 2004 :: [*****] FILE: ../player/i/Ithildin LINE: 326
Wed May 19 00:20:56 2004 :: [*****] BUG: Fread_char: no match: 256
Wed May 19 00:20:56 2004 :: Ithildin@63.140.119.19(Exception) has connected.
Segmentation fault (core dumped)


i put

char * namewho; in char_data struct

and had the code that i listed above. and what it did was completely take out color and evertyhign was green like smaug with no ansi.

so i don't know what to do.
USA #3
You must have had something else. The code you posted wouldn't crash the MUD when you add a namewho.

Did you remember to make clean and recompile after modifying the header file?
USA #4
i didn't rm *.o i just did the make. i'm cleanin it up right now...
USA #5
it made clean and worked, but it isn't showing the color. heres what i have.


in do_who


char char_name[MAX_INPUT_LENGTH];
	char char_namewho[MAX_INPUT_LENGTH];\

further down...


if ( fShowHomepage
	&&   wch->pcdata->homepage
	&&   wch->pcdata->homepage[0] != '\0' )
	  sprintf( char_name, "<A HREF=\"%s\">%s</A>",
		show_tilde( wch->pcdata->homepage ), wch->name );
	else
	  strcpy( char_namewho, wch->name );


further down...

if ( xIS_SET(wch->act, PLR_WIZINVIS) )
	  sprintf( invis_str, "(%d) ", wch->pcdata->wizinvis );
	else
	  invis_str[0] = '\0';
	sprintf( buf, "\n\r&w[&W%*s%-18s&w] %s%s%s%s%s%s%s %s%s%s%s &w(&W%s&w)",
	  (fGroup ? whogr->indent : 0), "",
	  class,
	  invis_str,
          (wch->desc && wch->desc->connected) ? "" : "",
	  xIS_SET(wch->act, PLR_AFK) ? "" : "",
	  xIS_SET(wch->act, PLR_ATTACKER) ? "" : "",
	  xIS_SET(wch->act, PLR_KILLER) ? "" : "",
	  xIS_SET(wch->act, PLR_THIEF)  ? ""  : "",
	  char_namewho,
	  	  wch->pcdata->title,
          extra_title,
	  clan_name,
	  council_name, 
	  get_race_name_color(wch));

then, in mud.h

char *		name;
	char *		namewho;


along with all the other code i showed you.
USA #6
i'm an idiot. here's what i was doing wrong.


strcpy( char_namewho, wch->name );

should have been

strcpy( char_namewho, wch->namewho );



it works now.
USA #7
I saw that, but I figured you were doing it on purpose. To be honest your whole ifcheck seems a little weird to me, but I think that is the default SMAUG code.

Anyways, glad you figured out your problem. :)