Author Topic: Door problem  (Read 2075 times)

Offline z993126

  • BFF
  • ***
  • Posts: 128
    • View Profile
Door problem
« on: December 10, 2011, 11:57:54 pm »
Here's a simple set of rooms and doors.  It only allows me to refer to 'east door' from room420, not 'west door'.  Not sure why.

Code: [Select]
/* /domains/dungeons/room/one/rm420.c
 * 2011-Dec-08 T. Cook
 * -----------
 * 2011-Dec-10 T. Cook added 400 to x-coordinate
 */
#include <lib.h>
#include <terrain_types.h>
#include ROOMS_H

inherit LIB_ROOM;

static void create(){
room::create();
SetClimate( "temperate" );
SetTerrainType( T_INDOORS );
SetAmbientLight( 25 );
SetShort( "a dungeon" );
SetCoordinates( "404,2,0" );
SetLong( "This is the north end of a corridor in a dungeon." );
SetWorld( "Dungeon" );
SetTown( "One" );
SetExits( ([
"east"  : "/domains/dungeons/room/one/rm520",
"west"  : "/domains/dungeons/room/one/rm320"
]) );
SetDoor( "east",  "/domains/dungeons/doors/one/door1-3" );
SetDoor( "west",  "/domains/dungeons/doors/one/door1-2" );
}

void init(){ ::init(); }
/* EOF */

Code: [Select]
/* /domains/dungeons/room/one/rm520.c
 * 2011-Dec-08 T. Cook
 * -----------
 * 2011-Dec-10 T. Cook added 400 to x-coordinate
 */
#include <lib.h>
#include <terrain_types.h>
#include ROOMS_H

inherit LIB_ROOM;

static void create(){
room::create();
SetClimate( "temperate" );
SetTerrainType( T_INDOORS );
SetAmbientLight( 25 );
SetShort( "a dungeon" );
SetCoordinates( "405,2,0" );
SetLong( "This is a dungeon." );
SetWorld( "Dungeon" );
SetTown( "One" );
SetExits( ([
"west"  : "/domains/dungeons/room/one/rm420"
]) );
SetDoor( "west",  "/domains/dungeons/doors/one/door1-3" );
}

void init(){ ::init(); }
/* EOF */

Code: [Select]
/* /domains/dungeons/room/one/rm320.c
 * 2011-Dec-08 T. Cook
 * -----------
 * 2011-Dec-10 T. Cook added 400 to x-coordinate
 */
#include <lib.h>
#include <terrain_types.h>
#include ROOMS_H

inherit LIB_ROOM;

static void create(){
room::create();
SetClimate( "temperate" );
SetTerrainType( T_INDOORS );
SetAmbientLight( 25 );
SetShort( "a dungeon" );
SetCoordinates( "403,2,0" );
SetLong( "This is a dungeon." );
SetWorld( "Dungeon" );
SetTown( "One" );
SetExits( ([
"east"  : "/domains/dungeons/room/one/rm420"
]) );
SetDoor( "east",  "/domains/dungeons/doors/one/door1-2" );
}

void init(){ ::init(); }
/* EOF */

Code: [Select]
/* /domains/dungeons/doors/one/door1-2.c
 * 2011-Dec-09 T. Cook
 */
#include <lib.h>

inherit LIB_DOOR;

static void create(){
door::create();
SetSide( "east", ([
"id" : ({ "door", "heavy door", "east door" }),
"short" : "a door",
"long" : "This is a heavy wooden door.",
"lockable" : 1
]) );
SetKeys( "east", ({ "copper key", "master key" }) );
SetSide( "west", ([
"id" : ({ "door", "heavy door", "west door" }),
"short" : "a door",
"long" : "This is a heavy wooden door.",
"lockable" : 1
]) );
SetKeys( "west", ({ "copper key", "master key" }) );
SetClosed( 1 );
SetLocked( 1 );
}
void init(){ ::init(); }
/* EOF */

Code: [Select]
/* /domains/dungeons/doors/one/door1-3.c
 * 2011-Dec-09 T. Cook
 */
#include <lib.h>

inherit LIB_DOOR;

static void create(){
door::create();
SetSide( "east", ([
"id" : ({ "door", "heavy door", "east door" }),
"short" : "a door",
"long" : "This is a heavy wooden door.",
"lockable" : 1
]) );
SetKeys( "east", ({ "copper key", "master key" }) );
SetSide( "west", ([
"id" : ({ "door", "heavy door", "west door" }),
"short" : "a door",
"long" : "This is a heavy wooden door.",
"lockable" : 1
]) );
SetKeys( "west", ({ "copper key", "master key" }) );
SetClosed( 1 );
SetLocked( 1 );
}
void init(){ ::init(); }
/* EOF */

Code: [Select]
/* /domains/dungeons/obj/one/key1.c
 * 2011-Dec-10 T. Cook
 */
#include <lib.h>

inherit LIB_ITEM;

static void create(){
item::create();
SetKeyName( "key" );
SetId( ({ "key", "copper key" }) );
SetAdjectives( ({ "copper" }) );
SetShort( "a copper key" );
SetLong( "This is a plain copper key with no markings." );
SetMass( 1 );
SetBaseCost( 10 );
SetDisableChance( 100 );
}

void init(){ ::init(); }
/* EOF */
« Last Edit: December 11, 2011, 12:01:36 am by z993126 »

Offline z993126

  • BFF
  • ***
  • Posts: 128
    • View Profile
Re: Door problem
« Reply #1 on: December 11, 2011, 12:56:45 am »
Turns out that the problem lies in the fact that the doors were identical.  Changing the order of SetSide() calls in one fixed things.

Offline z993126

  • BFF
  • ***
  • Posts: 128
    • View Profile
Re: Door problem
« Reply #2 on: December 11, 2011, 01:18:04 am »
The ACTUAL problem was in the first id of the doors being "door".  Changing that to a unique value is what really fixed things.

Offline quixadhal

  • BFF
  • ***
  • Posts: 642
    • View Profile
    • WileyMUD
Re: Door problem
« Reply #3 on: December 11, 2011, 10:34:23 pm »
It might be nice to change the parser to ask for disambiguation when multiple objects exist that don't have a distinct keyword.

IE:  If door 1 has "door", "east door", "wooden door"; and door 2 has "door", "west door", "wooden door"; and you type "open west door", it should compare each keyword against what you typed for an exact match FIRST, and if it doesn't find one (and only one) result, try to disambiguate things.

"open door" should fail with "which door would you like to open?" or something similar, if there are two or more "door" matches.