Tangential to the Unthing vocabulary backstop here, suppose you want a more nuanced vocabulary handling? Instead of a canned ‘cannot see that’ message for all invocations, suppose you want some different messaging or even verb handling for absent but game-implemented items? There are a few challenges to this, the biggest being Unthing
has location like any other object and most physical verbs precondition that the actor must see the item.
As an example, let us suppose that we are implementing a camera, but also implement a variety of “pictures” throughout the game. If a physical picture is present, we want to prioritize that for verbs, but absent a physical picture we would like ‘>TAKE PICTURE’ to remap to using the camera. First we need to Globalize the Unthing as follows:
// globally 'visible' item
class GlobalUnthing : Unthing
// mimicing NOTHEREMSG on purpose, for most verbs we want this.
// note usage model requires redundant vocabulary to other objects
// and UNTHING base ensures it only resolves if no others present
notHereMsg = 'You see no <<origText>> here. '
origText = gAction.dobjMatch.getOrigText()
;
modify Actor
canSee(obj) {
if (obj.ofKind(GlobalUnthing)) return true;
else return inherited(obj);
}
;
modify TAction
objInScope(obj) {
if (obj.ofKind(GlobalUnthing)) return true;
return inherited(obj);
}
;
Now we have a globally visible item, that only manifests if its vocab does not resolve to another immediately present object. All that’s left is to use it!
picForTaking : GlobalUnthing 'pic/picture/photo/photograph'
dobjFor(Take)
maybeRemapTo(camera.isIn(gActor) &&
rexMatch(R'take*', gAction.getEnteredVerbPhrase()),
Snap, camera)
;
The rexMatch
is only there to ensure >GET PHOTO doesn’t take a picture. You get the idea. For this example, you would probably want to add some clarifying text if a physical picture is also present, letting the player know how to use the camera instead if that’s what they wanted.
There is also the question of global smell and sound sensing, if that makes any sense for the object in question, not covered above.
Would love to hear if anyone else went down this path, and how they managed it? So far, this is working for me!