[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  altering do_save so level ones can save
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

altering do_save so level ones can save

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


Posted by Gadush   (92 posts)  [Biography] bio
Date Sat 09 Apr 2005 11:38 PM (UTC)
Message
Hi all,
I removed the mprog that advanced a character to level 2 upon a new character entering the mud, since I wanted all to start at level one.
It works, but a level one character is not allowed to save. Have to be level two.
So, I searched the source for the 'You have to be level two to save' message, and found it in act_comm, in function do_save.
Below is my modification.


void do_save( CHAR_DATA *ch, char *argument )
{
    if ( IS_NPC(ch) )
	return;
    /* if ( ch->level < 2 ) {
	send_to_char_color( "&BYou must be at least second level to save.\n\r", ch );
	return;
     }
    */

    WAIT_STATE( ch, 2 ); /* For big muds with save-happy players, like RoD */
    update_aris(ch);     /* update char affects and RIS */
    save_char_obj( ch );
    saving_char = NULL;
    send_to_char( "Saved...\n\r", ch );
    return;
}


I then made clean and compiled. Mud works good, but when a new character tries to save, they get the right message "Saved . . ." but their pfile does not get written. They are not, in fact, saved.
I read the posts on problems saving, but none of them seem to be this problem. All the directories are there, in the correct order. This is something I did by changing the code. Can anyone tell me what I did wrong? It seems like commenting out that if check would work, but I am just learning as I go.
Any help is appreciated.
Gadush
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] bio
Date Reply #1 on Sun 10 Apr 2005 12:33 AM (UTC)
Message
You did that correctly, but the save goes beyond do_save. Check in the saving function, it'll have something like:
if ( ch->level < 2 )
return;

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] top

Posted by Gadush   (92 posts)  [Biography] bio
Date Reply #2 on Sun 10 Apr 2005 03:46 AM (UTC)
Message
Hmmm I can't find it. I searched the whole src folder with TextPad, and only found that string in two files, act_comm and act_info. The one in act_info was already commented out and regarded practice.
Anyone have a clue where or what is wrong here?
Thanks,
Gadush
[Go to top] top

Posted by Nick Cash   USA  (626 posts)  [Biography] bio
Date Reply #3 on Sun 10 Apr 2005 04:11 AM (UTC)
Message
Check save_char_obj. Mine says (in save.c under save_char_obj):

    if ( IS_NPC(ch) || ch->level < 2 )
	return;

Remove the portion relating to level and you should be all set :)

~Nick Cash
http://www.nick-cash.com
[Go to top] top

Posted by Gadush   (92 posts)  [Biography] bio
Date Reply #4 on Sun 10 Apr 2005 01:58 PM (UTC)
Message
Thanks, Whiteknight. I changed that, and the pfile is now being written. It seems to not be writing the correct vnum of the room the character has saved in, but always sets it to 21001. I'll see if I can figure that out in a bit.
Gadush
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] bio
Date Reply #5 on Sun 10 Apr 2005 05:02 PM (UTC)
Message
I think that there was a reason it could never save a level 1, but I'm not sure. Another way you can fix this is to simply set the starting level of players to 2.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] top

Posted by Nick Cash   USA  (626 posts)  [Biography] bio
Date Reply #6 on Sun 10 Apr 2005 05:12 PM (UTC)
Message
Well, I looked in mud.h and I saw this:

#define ROOM_VNUM_TEMPLE	  21001

Go around and see where it references to it, as your answer will be in there somewhere.

However, this seem's more likely to be the problem if its saving your vnum's a little funny (save.c under fwrite_char):

    fprintf( fp, "Room         %d\n",
	(  ch->in_room == get_room_index( ROOM_VNUM_LIMBO )
	&& ch->was_in_room )
	    ? ch->was_in_room->vnum
	    : ch->in_room->vnum );

Maybe you can find the problem based off those.

~Nick Cash
http://www.nick-cash.com
[Go to top] top

Posted by Gadush   (92 posts)  [Biography] bio
Date Reply #7 on Sun 10 Apr 2005 07:07 PM (UTC)
Message
Thanks for all the help guys. I haven't had time to search much today, but I tested a bit more. It is not saving my char position because I was in a new (unfinished) area when I logged out. Sorry for the confusion.
Once more, thanks a lot.
Gadush
[Go to top] 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.


4,603 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]