Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ note command

note command

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Ithildin   USA  (262 posts)  Bio
Date Wed 07 Apr 2004 05:36 AM (UTC)
Message
i'm wanting to make it to where we don't use boards to post a note. i want the character to be able to post it globally. envy has a really good way for notes. all you do is type:

note to all
note subject *subject*
note + *message*
note post

and it posts to everyone. smaugFUss is too complicated. i jsut want it simplified. i've been trying to convert the envy over to smaug but it's been long and tedious and i'm not that good. i've got it down to a lot of errors instead of MANY errors. heh. is there any easier way to do this?
Top

Posted by Ithildin   USA  (262 posts)  Bio
Date Reply #1 on Sat 10 Apr 2004 01:07 AM (UTC)
Message
Nevermind, i ported the envy22 over to smaug. yay for me. hehe. i'm ecstatic about doing this by myself. lol. i'm not a newbie coder anymore!!! ok wait, i still am. but now i have global notes and exactly how i wanted them.
Top

Posted by Ithildin   USA  (262 posts)  Bio
Date Reply #2 on Sat 10 Apr 2004 01:50 AM (UTC)
Message
*slinks back into newbie coder mode*

ok, on first reboot when i had no notes, everything went fine, i wrote a couple notes, rebooted, and now i get a bug along with the notes are showing up as new notes again. i still have to put the finishing touches in my save file etc. i forgot about those little details..heh. but i do need some help i think with this:

this is what i need to port over to smaug in fread_char. this is the envy code.


{ "Note",   FALSE, 0,			{ &ch->last_note,     NULL } },


i know that's not how to write it. i figure that it might have to look something along these lines.
here is the smaug code:

	case 'N':
	    KEY ("Name", ch->name, fread_string( fp ) );
            KEY ("NoAffectedBy", ch->no_affected_by, fread_bitvector( fp ) );
            KEY ("NoImmune", ch->no_immune, fread_number( fp ) );
            KEY ("NoResistant", ch->no_resistant, fread_number( fp ) );
            KEY ("NoSusceptible", ch->no_susceptible, fread_number( fp ) );
	    if ( !strcmp ( "Nuisance", word ) )
            {
                fMatch = TRUE;
                CREATE( ch->pcdata->nuisance, NUISANCE_DATA, 1 );
                ch->pcdata->nuisance->time = fread_number( fp );
                ch->pcdata->nuisance->max_time = fread_number( fp );
                ch->pcdata->nuisance->flags = fread_number( fp );
		ch->pcdata->nuisance->power = 1;
            }
	    if ( !strcmp ( "NuisanceNew", word ) )
	    {
		fMatch = TRUE;
		CREATE( ch->pcdata->nuisance, NUISANCE_DATA, 1 );
		ch->pcdata->nuisance->time = fread_number( fp );
		ch->pcdata->nuisance->max_time = fread_number( fp );
		ch->pcdata->nuisance->flags = fread_number( fp );
		ch->pcdata->nuisance->power = fread_number( fp );
	    }
	    break;


i'm figuring that just:


KEY ("Note",  ch->last_note, fread_number( fp ) );


won't work even though it does compile cleanly.


i put the code into nanny to get the number of notes when they log in, but it crashes the mud before i can log in. i'll try to move that around a little bit.

Top

Posted by Ithildin   USA  (262 posts)  Bio
Date Reply #3 on Sat 10 Apr 2004 01:56 AM (UTC)

Amended on Sat 10 Apr 2004 01:58 AM (UTC) by Ithildin

Message
here's envy code in nanny:


do_look( ch, "auto" );
	/* check for new notes */
	notes = 0;

	for ( pnote = note_list; pnote; pnote = pnote->next )
	    if ( is_note_to( ch, pnote ) && str_cmp( ch->name, pnote->sender )
		&& pnote->date_stamp > ch->last_note )
	        notes++;

	if ( notes == 1 )
	    send_to_char( "\n\rYou have one new note waiting.\n\r", ch );
	else
	    if ( notes > 1 )
	    {
		sprintf( buf, "\n\rYou have %d new notes waiting.\n\r",
			notes );
		send_to_char( buf, ch );
	    }


and here's my code in smaug:


do_look( ch, "auto" );

    if ( !ch->was_in_room && ch->in_room == get_room_index( ROOM_VNUM_TEMPLE ))
      	ch->was_in_room = get_room_index( ROOM_VNUM_TEMPLE );
    else if ( ch->was_in_room == get_room_index( ROOM_VNUM_TEMPLE ))
        ch->was_in_room = get_room_index( ROOM_VNUM_TEMPLE );
    else if ( !ch->was_in_room )
    	ch->was_in_room = ch->in_room;

	/* check for new notes */
	notes = 0;

	for ( pnote = note_list; pnote; pnote = pnote->next )
	    if ( is_note_to( ch, pnote ) && str_cmp( ch->name, pnote->sender )
		&& pnote->date_stamp > ch->last_note )
	        notes++;

	if ( notes == 1 )
	    send_to_char( "\n\rYou have one new note waiting.\n\r", ch );
	else
	    if ( notes > 1 )
	    {
		sprintf( buf, "\n\rYou have %d new notes waiting.\n\r",
			notes );
		send_to_char( buf, ch );
	    }


i'm not sure what's wrong.

any thoughts?

______________________________________

i can start a new character, but as soon as i type note, it crashes. so it's got to be in the save.c file i would guess? but i don't know. i don't know how to use gdb. i tried that one link, but i couldn't get anything to work.
Top

Posted by Ithildin   USA  (262 posts)  Bio
Date Reply #4 on Sat 10 Apr 2004 03:11 AM (UTC)
Message
i tried to use gdb again here's my ls -lt:


$ ls -lt
total 2165
-rwxr-x---    1 TYLER    None          752 Apr  9 21:09 smaug.exe.stackdump
-rw-r--r--    1 TYLER    None         1597 Apr  9 19:24 NOTES.TXT
-rw-r-----    1 TYLER    None       614668 Apr  9 19:13 help.are
-rw-r--r--    1 TYLER    None          315 Apr  9 18:55 shutdown.txt
-rw-r--r--    1 TYLER    None       171281 Apr  7 01:17 newdark.are


some of it anway, the top one is my segment fault.

when i try to look for a core file though i don't get anything.

$ ls -lt core*
ls: core*: No such file or directory

and when i try to run 752..

$ gdb ../src/smaug core.752
GNU gdb 2003-09-20-cvs (cygwin-special)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-cygwin"...
/home/TYLER/smaugfuss/area/core.752: No such file or directory.
(gdb)


all my sigvio is commented out just like you said to do. i'm using smaugfuss, maybe that has something to do with it.


Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #5 on Sat 10 Apr 2004 03:15 AM (UTC)
Message
Why did you type:


$ gdb ../src/smaug core.752

when there is no such file?

Do you mean process ID 752? (Did you do a "ps" and find that number?)

In that case you want:

gdb ../src/smaug 752

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Ithildin   USA  (262 posts)  Bio
Date Reply #6 on Sat 10 Apr 2004 03:23 AM (UTC)
Message
would my note in save.c look something like this:


if ( !strcmp ( "Note", word ) )
			{
				fmatch = TRUE;
				CREATE(ch->pcdata->last_note, NOTE_DATA, 1 );
				ch->pcdata->last_note= fread_number( fp );


it didn't compile. it had errors.


save.c:1410: error: `fmatch' undeclared (first use in this function)
save.c:1410: error: (Each undeclared identifier is reported only once
save.c:1410: error: for each function it appears in.)
save.c:1411: warning: assignment makes integer from pointer without a cast
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #7 on Sat 10 Apr 2004 03:26 AM (UTC)
Message
You have to be precise, it is "fMatch" not "fmatch".

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Ithildin   USA  (262 posts)  Bio
Date Reply #8 on Sat 10 Apr 2004 03:27 AM (UTC)
Message

$ ls -lt
total 2165
-rwxr-x---    1 TYLER    None          814 Apr  9 21:26 smaug.exe.stackdump
and so on


$ gdb ../src/smaug 814
GNU gdb 2003-09-20-cvs (cygwin-special)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-cygwin"...
Can't attach to process.
/home/TYLER/smaugfuss/area/814: No such file or directory.
(gdb)


still no file. i'm not sure what i'm really doin with gdb.
Top

Posted by Ithildin   USA  (262 posts)  Bio
Date Reply #9 on Sat 10 Apr 2004 04:49 AM (UTC)
Message
so i took out these lines in save.c

fprintf( fp, "Note         %ld\n",   (unsigned long)ch->last_note );

//			KEY ("Note",  ch->last_note, fread_number( fp ) );
		/*
		if ( !strcmp ( "Note", word ) )
			{ 
				fMatch = TRUE;
				CREATE(ch->pcdata->last_note, NOTE_DATA, 1 );
				ch->pcdata->last_note= fread_number( fp );
			}
			
			*/



the notes are working. no crashes, but if i read a note, then log back on, it still says i have a new note. and i have to read it again. i just need to find out how to write the above code into my code. hrmm...suggestions?
Top

Posted by Ithildin   USA  (262 posts)  Bio
Date Reply #10 on Sat 10 Apr 2004 04:53 AM (UTC)
Message
well..i don't know what happened or what i did. but it seems to be working fine right now. i put those code lines back in. and it's working like it is supposed to. i have no idea what i did though. wierd.

but hey, it's working.
Top

Posted by Ithildin   USA  (262 posts)  Bio
Date Reply #11 on Sat 10 Apr 2004 05:14 AM (UTC)

Amended on Sat 10 Apr 2004 05:24 AM (UTC) by Ithildin

Message
well it's kind of working. it just randomly crashes sometimes during the note send. it always crashes on note remove. i don't know what's up with that.


________________________________________

so it crashes when i type note send. i restart up, i note send again and it's fine. i reboot and try another note. crash. it just randomly crashes...this is upsetting.
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #12 on Sat 10 Apr 2004 07:34 AM (UTC)
Message
Can't help you with random crashes. I suggest you concentrate on getting gdb to work.

You should be able to go to your area directory, and then type:

gdb ../src/smaug

That will fire up the server, using gdb. Then when it crashes you will find out where.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


34,220 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.