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 ➜ Keeping skills during remort

Keeping skills during remort

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


Posted by Rash   United Kingdom  (56 posts)  Bio
Date Tue 04 Nov 2003 10:40 AM (UTC)
Message
I have just installed remort to my mud, and im wondering how to get the players to keep the skills and spells they have accuried so far... i.e. keep word of recall from been a mage then remorting to warrior... and still have it.
Normally you lose them... i dont want this to happen... any ideas? iv tried myself and i cant figure it out.
Thankx

Rash
Top

Posted by Rash   United Kingdom  (56 posts)  Bio
Date Reply #1 on Wed 05 Nov 2003 08:51 PM (UTC)
Message
Okay ill show the code before the problem...

Inside remort.c in do_remort()
i have:
ch->pcdata->mclass[0] = oldch->class;
if( ch->pcdata->tier == 2 )
ch->pcdata->mclass[1] = ch->class;
else
ch->pcdata->mclass[1] = oldch->class;
if( ch->pcdata->tier == 3 )
ch->pcdata->mclass[2] = ch->class;
else
ch->pcdata->mclass[2] = oldch->class;

Inside comm.c in function nanny()
after:
    case CON_READ_MOTD:
	{
	  char motdbuf[MAX_STRING_LENGTH];

	  sprintf( motdbuf, "\n\rWelcome to %s...\n\r", sysdata.mud_name);
	  write_to_buffer( d, motdbuf, 0 );
	}
	add_char( ch );
	d->connected	= CON_PLAYING;


I have:
if( ch->pcdata->mclass[0] == NULL )
{
ch->pcdata->mclass[0] = ch->class;
ch->pcdata->mclass[1] = -1;
ch->pcdata->mclass[2] = -1;
}

in name_stamp_stats( ch );
after

set_title( ch, buf );


i have:

            ch->pcdata->mclass[0] = ch->class;
  	    ch->pcdata->mclass[1] = -1;
	    ch->pcdata->mclass[2] = -1;


Inside save.c in fwrite_char()under:


    fprintf( fp, "Class        %d\n",	ch->class		);

I have this...

fprintf( fp, "mclass       %d %d %d\n", ch->pcdata->mclass[0]?ch->pcdata->mclass[0]: -1, ch->pcdata->mclass[1]?ch->pcdata->mclass[1]:-1, ch->pcdata->mclass[2]?ch->pcdata->mclass[2]:-1 );


and in fread_char() under case 'M'
i have:

            if ( !strcmp( word, "mclass" ) )
	    {
                ch->pcdata->mclass[0] = fread_number( fp );
	        ch->pcdata->mclass[1] = fread_number( fp );
	        ch->pcdata->mclass[2] = fread_number( fp );
	    }


What im trying to do is get remort to write to a pc_data struc (which iv made in mud.h allready) when your first make a character with 'mclass <current class> -1 -1'

then when your remort the first time change it to
'mclass <first class> <current class> -1'

then the final remort change it to:
'mclass <first class> <second class> <current class>'

that way i can get do_practice to read mclass instead of class and that should then display all the practices that can be used by those THREE classes (if you can help with any of this let me know please!)

btw the following comes back with when u remort


[*****] BUG: Fread_char: no match: Mclass
[*****] BUG: Fread_char: no match: -1
[*****] BUG: Fread_char: no match: -1
[*****] BUG: Fread_char: no match: -1
[*****] BUG: Fread_char: no match: Mclass
[*****] BUG: Fread_char: no match: -1
[*****] BUG: Fread_char: no match: -1
[*****] BUG: Fread_char: no match: -1


and again when you login:


[*****] BUG: Fread_char: no match: Mclass
[*****] BUG: Fread_char: no match: -1
[*****] BUG: Fread_char: no match: -1
[*****] BUG: Fread_char: no match: -1
[*****] BUG: Fread_char: no match: Mclass
[*****] BUG: Fread_char: no match: -1
[*****] BUG: Fread_char: no match: -1
[*****] BUG: Fread_char: no match: -1


Any help would be really really great!!!!

Rash
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #2 on Wed 05 Nov 2003 09:32 PM (UTC)
Message
Don't know about your remort stuff, but you certainly need to add in fMatch = true in your fread_char routines. That tells it that it found a match - just look at the other routines.

Also note that it seems to expect the first letter to be capitalized. You may want to save it as Mclass %d %d %d instead of mclass %d %d %d.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Rash   United Kingdom  (56 posts)  Bio
Date Reply #3 on Wed 05 Nov 2003 10:04 PM (UTC)
Message
it saves the pfile with no bugs now... but it still wont read it right... keep em coming thankx btw... half way there... im still getting the reading the pfile bug...
anyway keep the ideas coming thankx!!!!
Top

Posted by Nick Cash   USA  (626 posts)  Bio
Date Reply #4 on Wed 05 Nov 2003 11:35 PM (UTC)

Amended on Wed 05 Nov 2003 11:38 PM (UTC) by Nick Cash

Message
Try this for reading it (modeled after my Addiction section):


            if ( !str_cmp( word, "Mclass" ) )
            {
                line = fread_line( fp );
                x0=x1=x2=0;
                sscanf( line, "%d %d %d", &x0, &x1, &x2 );
                ch->pcdata->mclass[0] = x0;
	        ch->pcdata->mclass[1] = x1;
	        ch->pcdata->mclass[2] = x2;
                fMatch = TRUE;
                break;
            }


Hope that helps. Also, this assumes you change the m to a capital like Ksilyan suggested.

Good luck.

~Nick Cash
http://www.nick-cash.com
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #5 on Thu 06 Nov 2003 (UTC)
Message
Actually, here's a completely random fact, but useful to know:

strcmp is the library version of string comparison. It is case sensitive.
str_cmp is the SMAUG version of the string comparison. It is case insensitive.

This, for example, is a very good example of why it's important to name your functions correctly. The SMAUG team should have called their function str_icmp or something to that effect, to make it obvious that it is doing a case insensitive comparison.

So, str_cmp(word, "HAHAHA") is equivalent to str_cmp(word, "hAhaHa"), but strcmp of the same arguments is not equivalent.

Anyways, that's just a random fact, and most people can probably ignore that... but it might be useful to some, or at least explain some behavior that you weren't expecting.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
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.


16,810 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.