Author Topic: room updates, but loads with error  (Read 2817 times)

Offline detah

  • BFF
  • ***
  • Posts: 190
  • Ruler of 2D
    • View Profile
room updates, but loads with error
« on: February 10, 2010, 12:56:17 am »
I added several functions to /lib/std/room.c. Then I wrote a brand new room using some of those functions.
/lib/std/room.c updated with no errors. /domains/default/room/arcania1.c updated with no errors also.
Then I did
goto /domains/default/room/arcania1.c
and I got the following error:

Code: [Select]
--- Arcania
2010.02.09-20.37,27
*Bad type argument to +. Had string and mapping
Object: /secure/save/creators/d/detah (/lib/events/describe.c) at line 106

'<fake>' at /secure/save/creators/d/detah (/<driver>) at line 0
'cmdAll' at /secure/save/creators/d/detah (/lib/command.c) at line 210
'do_look' at /verbs/items/look at line 96
'eventDescribeEnvironment' at /secure/save/creators/d/detah (/lib/creator.c) at
line 116
'eventDescribeEnvironment' at /secure/save/creators/d/detah
(/lib/events/describe.c) at line 106
Trace written to /log/runtime

I never touched any of the player.c or creator.c code. But there seems to be an issue with /lib/events/describe.c at L106. Is that what this error message is telling me? If so here it is and I have no idea what it means.

Code: [Select]
    if( smell ) this_object()->eventPrint("%^GREEN%^" + smell, MSG_ROOMDESC);

I didn't touch that file either. It is all stock.
Any help would be appreciated.

Kalinash

  • Guest
Re: room updates, but loads with error
« Reply #1 on: February 10, 2010, 02:59:45 pm »
You need to call ::create() in your room's create() function in order to initialize the base class.

Offline Raudhrskal

  • BFF
  • ***
  • Posts: 214
  • The MUD community needs YOUR help!
    • View Profile
Re: room updates, but loads with error
« Reply #2 on: February 10, 2010, 04:22:46 pm »
Code: [Select]
*Bad type argument to +. Had string and mapping
(...)
Code: [Select]
if( smell ) this_object()->eventPrint("%^GREEN%^" + smell, MSG_ROOMDESC);

Sounds to me that var smell has a mapping assigned to it... AND I vaguely recall having a similiar problem.
In short, many of the room-related SetWhatever() (smell, listen, and soon) don't do any type checking at all... and get called from some weird piece of describe code sometimes? (Yes, vague...)
Check if eval return load_object("/path/to/room")->GetSmell() returns a string, or a mapping. If the latter, you need to find out WHAT sets it to that value.
I think, therefore i may be wrong.
Please note that if you met a Raudhrskal in a place that's not related to muds, it wasn't me. *sigh*... back when I started there was zero hits on google for that name...

Offline detah

  • BFF
  • ***
  • Posts: 190
  • Ruler of 2D
    • View Profile
Re: room updates, but loads with error
« Reply #3 on: February 10, 2010, 11:16:58 pm »
Before you posted, R, I accidentally discovered that that is indeed the source of the problems. The real problem (for me) in describe.c begins at L76
Code: [Select]
        if(functionp(tmp = env->GetSmell("default")))
            tmp = (*tmp)("default");
        smell = tmp;

This is problematic for me because my GetSmell function takes a mapping as its argument. It looks like stock ds takes a mixed type, but it initialized to be a string here. I commented out the 9 lines in describe.c and now it all works without error.

I now have my first genuine completely original Arcania room online. KAZAA!

Thank you both.

Kal- I implemented your suggestion. That was surely an underlying problem, but I was still generated numerous errors on the describe even after implementing your suggestion. Thank you for catching that.