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.
 Entire forum ➜ ROM ➜ Running the server ➜ [*****] BUG: Char_to_room: NULL

[*****] BUG: Char_to_room: NULL

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


Posted by Syciec   (6 posts)  Bio
Date Wed 30 Dec 2009 03:54 PM (UTC)
Message
I run the .exe to start the server, and it's loaded. I go through the character creation process, but when it gets to the end and says "Press RETURN to continue" the MUD crashes.

Here is the output in shell:

Project is running on port 2700.
Sock.sinaddr: 127.0.0.1
[*****] BUG: Char_to_room: NULL
[*****] BUG: Syciec
[*****] BUG: Extract_char: NULL
Syciec@127.0.0.1 new player
Syciec@127.0.0.1 has lost all common sense
*** BUG *** Crash!!! Recovery attempted.

Where should I be looking in the source to fix this? I search around for char_to_room and there are instances, but I'm unsure of what to amend or why.

Here is code from VOID extract_char:

VOID extract_char( PCHAR_DATA ch, BOOL fPull )
{
PCHAR_DATA wch;
POBJ_DATA obj;
POBJ_DATA obj_next;
PROOM_INDEX_DATA oldroom,newroom;

if ( ch->in_room == NULL )
{
bug( "Extract_char: NULL.", 0 );
return;
}


And here is code from VOID char_to_room:

VOID char_to_room( PCHAR_DATA ch, PROOM_INDEX_DATA pRoomIndex )
{
if ( pRoomIndex == NULL )
{
PROOM_INDEX_DATA room;

bug( "Char_to_room: NULL.", 0 );
bug(ch->name,0);
if ((room = get_room_index(ROOM_VNUM_LIMBO)) != NULL)
char_to_room(ch,room);
return;
}



Thanks :)
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #1 on Wed 30 Dec 2009 04:05 PM (UTC)
Message
What codebase are you using?

What is the starting room?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Nick Gammon   Australia  (23,121 posts)  Bio   Forum Administrator
Date Reply #2 on Thu 31 Dec 2009 04:42 AM (UTC)
Message
Were there errors during loading the areas? Did you alter the default area files, or file which lists which areas to load?

- Nick Gammon

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

Posted by Hanaisse   Canada  (114 posts)  Bio
Date Reply #3 on Thu 31 Dec 2009 06:03 AM (UTC)
Message
The function void char_to_room in the stock ROM and QuickMUD I looked at are vastly different than yours. You've not said if you've modified the code in any way.

void char_to_room   (CHAR_DATA * ch, ROOM_INDEX_DATA * pRoomIndex)
{
       OBJ_DATA *obj;

      if   (pRoomIndex == NULL)
     {
            ROOM_INDEX_DATA *room;

            bug ("Char_to_room: NULL.", 0);

            if   ((room = get_room_index (ROOM_VNUM_TEMPLE)) != NULL)
                  char_to_room (ch, room);

            return;
      }
etc, etc


It looks like your issue is your function has ROOM_VNUM_LIMBO instead of TEMPLE. New chars should never start in limbo.

aka: Hana
Owner in Training of: Fury of the Gods
alm-dev.org:4000
Top

Posted by Syciec   (6 posts)  Bio
Date Reply #4 on Sat 02 Jan 2010 09:11 PM (UTC)
Message
@Hanaisse: the code was sent to me by a friend. It's modified ROM code afaik.

@Nick: Now that you mention it, I did get a "area.lst not found" error before I got to this. I "fixed" it by creating a blank area.lst file and popping it into the area folder.

What would it need to contain to work? I'm fairly new to this.
Top

Posted by Hanaisse   Canada  (114 posts)  Bio
Date Reply #5 on Sat 02 Jan 2010 10:32 PM (UTC)
Message
Oh, well, no area.lst file is most likely the cause then.

You'll want area.lst to contain every .are file in your area folder in a simple list.

Example;
immort.are
midgaard.are
social.are
rom.are
school.are
limbo.are
help.are
$


These are probably the most important ones to load, but you can load up all your areas. Note the list must end with the $.

aka: Hana
Owner in Training of: Fury of the Gods
alm-dev.org:4000
Top

Posted by Nick Gammon   Australia  (23,121 posts)  Bio   Forum Administrator
Date Reply #6 on Sun 03 Jan 2010 12:49 AM (UTC)
Message
You could do:


ls -1 *.are


That would put each area name into a line on its own. Then copy and paste that into your area.lst file, adding a "$" on a line on its own at the end.

That is a "one" after the "ls" not an "L".

As Hanaisse said, if you don't load any areas, there aren't any rooms in the MUD, and it doesn't have anywhere to put people.

- Nick Gammon

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

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #7 on Sun 03 Jan 2010 12:55 AM (UTC)

Amended on Sun 03 Jan 2010 01:05 AM (UTC) by Twisol

Message
You could even automate it completely by doing this:

ls -1 *.are | cat > area.lst | echo $ | cat >> area.lst


That does the copying for you. (EDIT: figured out a way to add the last $, heh)

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Syciec   (6 posts)  Bio
Date Reply #8 on Fri 26 Mar 2010 06:01 PM (UTC)
Message
Oops it's been a while. I did amend the area.lst, but I still get the same problem. I make a new character, and as I'm about to enter the game, crash.
Top

Posted by Nick Gammon   Australia  (23,121 posts)  Bio   Forum Administrator
Date Reply #9 on Fri 26 Mar 2010 09:05 PM (UTC)

Amended on Fri 26 Mar 2010 09:06 PM (UTC) by Nick Gammon

Message
Did you fix the message about no area.list file? It is possible the starting room does not exist, very probable if it crashes the moment you start. You need to find what the starting room number is (look in mud.h or rom.h or whatever it is), and then make sure that room is in one of your area files.

Failing that, use gdb and put a breakpoint on the line:


bug ("Char_to_room: NULL.", 0);


Then do a backtrace (bt) and see what room number it is trying to use.

http://www.gammon.com.au/gdb

- Nick Gammon

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

Posted by Syciec   (6 posts)  Bio
Date Reply #10 on Tue 30 Mar 2010 12:43 AM (UTC)
Message
Lucky for me I have a friend who is a dabhand at this kind of thing, and he fixed it and the code is now running fine. The problem apparently was, and I quote, "there was multiple char_to_rooms".

So it was trying to spawn the person multiple times, and this was apparently causing the crash.

It's fixed now either way, but thanks for helping!
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.


35,948 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.