Hi. Im trying to simply create a locked door that the player can only open from one side, by pressing a button. I am having problems though. Sometimes the code seems to work fine and the door opens as it should do but other times it displays the message that it should do when the door is opened but then says “nothing obvious happens” and the player is in the same place.
The code is here:
corridor: Room 'entrance corridor' 'corridor'
"Its an entrance corridor coming from the reception area. To the west is the security door that you was previously blocking your way. <<securityDoorRS.isOpen ? nil : 'Maybe you can open it from this side.'>> "
west = securityDoorRS
in: OneWayRoomConnector
{
-> insideLift
travelBarrier = [powerBarrier]
}
east asExit(in)
;
+securityDoorRS: LockableWithKey, Door -> securityDoorLS 'security door' 'security door'
"It is a large security door. There is a button beside it. "
isLocked = true
;
++doorButton: Button, Component 'button' 'button'
"It is a small black button beside the security door."
dobjFor(Push)
{
action()
{
{
"Pressing the button unlocks the security door";
securityDoorLS.isLocked = nil;
securityDoorRS.isLocked = nil;
}
}
}
dobjFor(Press) remapTo(Push)
;
This links with the other side of the door here:
reception: Room 'Reception' 'reception'
"This is the reception of the research base. From somewhere inside you can get the lift down into the ice to where the research labs are located.
The reception desk sits in the middle of the room with an office chair behind it. A computer is on the desk. Benches and plants line the walls.
In the South-West corner is a room marked 'Reception staff only'. In the middle of the ceiling is some sort of vent. To the east is a large, sturdy looking security door."
initSpecialDesc = "Strangely, the reception is empty. Where is the rest of the research team? Or the staff for the matter?"
east= securityDoorLS
southwest = staffRoom
west: OneWayRoomConnector
{
->outsidePlane
travelBarrier=[crateBarrier]
}
up = ventGrill
+securityDoorLS : LockableWithKey, Door -> securityDoorRS 'security door' 'security door'
"It is a firm security door. You see no way of getting past without the staff around."
isLocked = true
CannotOpenMessage = "You cannot pull the door open with your hands, there must be a better way."
;
Im not very experienced with TADS but i modified the door stuff from tutorials and i just dont understand why sometimes it doesnt work… I cant see anything wrong with it. Any ideas?