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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  ROM
. -> [Folder]  Running the server
. . -> [Subject]  [*****] 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] Refresh page


Posted by Syciec   (6 posts)  [Biography] 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 :)
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] 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
[Go to top] top

Posted by Nick Gammon   Australia  (23,017 posts)  [Biography] 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
[Go to top] top

Posted by Hanaisse   Canada  (114 posts)  [Biography] 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
[Go to top] top

Posted by Syciec   (6 posts)  [Biography] 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.
[Go to top] top

Posted by Hanaisse   Canada  (114 posts)  [Biography] 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
[Go to top] top

Posted by Nick Gammon   Australia  (23,017 posts)  [Biography] 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
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] 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
[Go to top] top

Posted by Syciec   (6 posts)  [Biography] 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.
[Go to top] top

Posted by Nick Gammon   Australia  (23,017 posts)  [Biography] 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
[Go to top] top

Posted by Syciec   (6 posts)  [Biography] 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!
[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.


33,748 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 HostDash]