I have two doors in the same room. When the player types “Close Door”, I want to default to a certain door. Likewise, if the player types “Open Door”, I want it to default to the other door. So I use the following statement in the appropriate object:
dobjFor(Close) { verify() { logicalRank(120); } }
which works, in that the parser will pick that object over the other one.
However, the mechanism to keep track of it being open or closed doesn’t seem to work. I don’t know if I’m missing the mark or if it’s an issue somewhere in the library. For example, take the following code and the resulting script:[code]startroom: Room ‘The Starting Location’
"Add your description here. "
west = westDoor
east = eastDoor
;
-
westDoor : Door ‘small door; red’
"This is the small red door; it’s currently <<isOpen ? ‘open’ : ‘closed’>>. "
otherSide = westOtherDoor
dobjFor(Open) { verify() { logicalRank(120); } }
dobjFor(Close) { verify() { logicalRank(120); } }
isListed = true
; -
eastDoor : Door ‘large door; red’
"This is the large red door; it’s currently <<isOpen ? ‘open’ : ‘closed’>>. "
otherSide = eastOtherDoor
isListed = true
;
[/code]The first script is with the logicalRank method commented out (to show the parser confirming), the second script has logicalRank in place.[code]The Starting Location
Add your description here.
You can see a small door and a large door here.
x doors
large door: This is the large red door; it’s currently closed.
small door: This is the small red door; it’s currently closed.
open door
Which do you mean, the small door or the large door?
small
Opened.
close door
You close the small door.
close door
Which do you mean, the small door or the large door?
small
The small door isn’t open.[/code]Now with the logicalRank method in the door object.[code]The Starting Location
Add your description here.
You can see a small door and a large door here.
x doors
large door: This is the large red door; it’s currently closed.
small door: This is the small red door; it’s currently closed.
open door
You open the small door.
close door
You close the small door.
close door
You close the small door.
close door
You close the small door.
open door
You open the small door.
open door
You open the small door.
open door
You open the small door.[/code]
I can’t use vocabLikelihood because I don’t want to default to the same door object all the time, so is there something I’m missing?
Thanks,
– Mike