Anyone know how to get possessive adjectives working with ThingState?
Here’s a silly example where there’s a pebble.
class Pebble: Thing '(small) (round) blue Alice\'s pebble*pebbles' 'pebble'
"A small, round pebble.
It is blue and belongs to Alice. <.reveal alice> "
isEquivalent = true
;
startRoom: Room 'Void' "This is a featureless void.";
+me: Person;
+Pebble
allStates = static [ defaultState, aliceState ]
getState = (gRevealed('alice') ? aliceState : defaultState)
;
defaultState: ThingState
stateTokens = static [ ]
;
aliceState: ThingState
stateTokens = static [ 'Alice\'s', 'blue' ]
;
The pebble’s vocab includes the adjectives “blue” and “Alice’s”.
The pebble has two states. It starts out in defaultState, which has no stateTokens. It switches to aliceState when the pebble is examined.
aliceState has two stateTokens: “Alice’s” and “blue”.
When the game starts the adjective blue functions as expected: the adjective “blue” is excluded from the pebble’s vocabulary because it’s a token only present in an inactive state.
Void
This is a featureless void.
You see a pebble here.
>x blue pebble
You see no blue pebble here.
>x pebble
A small, round pebble. It is blue and belongs to Alice.
>x blue pebble
A small, round pebble. It is blue and belongs to Alice.
Great so far. But if we restart the game (or undo past the >X PEBBLE) the token “Alice’s” isn’t excluded from the pebble’s vocabulary due to being only on an inactive state:
Void
This is a featureless void.
You see a pebble here.
>x alice's pebble
A small, round pebble. It is blue and belongs to Alice.
Anyone know the fix for this off the top of their heads?
I think the problem is that declaring the possessive adjective in the Thing’s vocabulary causes adjApostS to be set, and ThingState.matchName() doesn’t pay any attention to that. Which would mean it’s a bug/unsupported feature, and the solution is writing a replacement ThingState.matchName().
Hm. Right, so it is matching via adjApostS, which is the form of the adjective without the apostrophe-S ending. In this case “Alice”.
Which means you’d have to add “Alice” to a ThingState’s stateTokens instead of “Alice’s”.
Buuuuut…unfortunately it looks like stateToken matching isn’t case-insensitive(?!)…so in order to work for both >x Alice's pebble and x alice's pebble you’d need to add both “Alice” and “alice” as stateTokens.
Is the fact that stateToken matching is case-insensitive just a bug, or is there some rationale that I’m overlooking?