Was mildly surprised to see only one TADS elevator discussion here: Elevator as Booth, or Room (TADS3)
Before consulting this forum’s history, which I really should get in the habit of doing, it occurred to me there are 4 obvious ways to elevator.
- As a Room whose travelConnector changes;
- As Booth with similar exit manipulation (and/or relocating the Booth itself);
- As Vehicle that travels between rooms;
- As near-identical static Rooms you just quietly teleport the PC between when floor is selected
Obviously a bit depends on the robustness of the physical model, and inherent assumptions. Can the player traverse floors OTHER ways? Do you need to model the elevator not being on the same floor? Can other characters use it?
In my hubris, and with some simplifying assumptions, I committed to the first without much thought or reflection. For simplicity, assume it is a two-position elevator, between lobby and upper hallway. While working fine, I am wondering if there are hidden drawbacks to this implementation vs Booth/Vehicle/Teleport. Or other solutions I may not be thinking of. Anyone have another implementation they care to share?
lobby : Room 'Hotel Lobby' 'hotel lobby'
"A hotel lobby. There is an elevator to the north. "
vocabWords = 'hotel entry/entryway/lobby'
north = elevatorOnFloor
;
+ elevatorEntry : Enterable ->elevatorOnFloor 'main hotel elevator'
'main elevator'
desc = "<<elevator.desc()>>" // since my elevator is always 'open'
// since vocab same as elevator proper
dobjFor(Enter) { verify() { logicalRank(120, 'elevatorIn'); } }
;
// This is the moving part!
elevatorOnFloor : RoomConnector
room1 = elevator
room2 = elevator.atLobby ? lobby : hallIntersection
;
elevator : Room 'Main Elevator' 'main elevator'
"A hotel elevator with control lever. Through the door you see
<<atLobby ? lobby.theName : hallIntersection.aName>>. "
// because desc also used by Enterables
remoteDesc(pov) { "A hotel elevator with control lever. " }
vocabWords = 'main hotel elevator'
atLobby = (liftLever.curSetting == 'LOBBY')
south = elevatorOnFloor
out asExit(south)
// only tricky part is here. Without this,
// going say north reports exit to south "back to <wrong floor>"
// could make more sophisticated by detecting floor and whether its been seen...
cannotGoThatWay() { reportFailure(cannotGoThatWayMsg); }
cannotGoThatWayMsg = 'The elevator\'s only exit is to the south. '
;
+ liftLever : Settable, Component 'control lever/selector' 'control lever'
"A lever, for selecting floors. It is currently pointing to <<curSetting>>. "
validSettings = ['LOBBY', 'HALLWAY']
curSetting = 'LOBBY'
canonicalizeSetting(val) { return delegated LabeledDial(val); }
isValidSetting(val) { return delegated LabeledDial(val); }
makeSetting(val) {
if (val != curSetting) {
"A short ride <<if (val == 'LOBBY')>>downward<<else>>upward<<end>>,
and you arrive at <<if (val == 'LOBBY')>>the lobby<<else>>a
long hallway<<end>>. ";
inherited(val);
} else "The lever is already on that setting. ";
}
;
hallIntersection : Room 'Hotel Hallway' 'long hallway'
"A long hallway. "
vocabWords = 'long hotel hall way/hallway'
north = elevatorOnFloor
;
+ upperElevatorEntry : Enterable ->elevatorOnFloor 'main hotel elevator'
'main elevator'
desc = "<<elevator.desc()>>" // since my elevator is always 'open'
// since vocab same as elevator proper
dobjFor(Enter) { verify() { logicalRank(120, 'elevatorIn2'); } }
;