Digging non-existent holes

DIG is not super important in my WIP, but occasionally it is important.

Today I encountered the situation where I realised the player, who’s thinking of digging, may type DIG HOLE. Well, the hole doesn’t exist yet. It gets moved into place when they DIG, or DIG SAND. So an initial DIG HOLE would say ‘you can’t see a hole.’

I have some other holes in the game. Usually they’re already in a room when you walk in. Digging new holes is a generally-very-unimportant mechanic.

So I was trying to think of a non-hectic solution to this.

  1. If I equate DIG HOLE to the action DIG, typing DIG HOLE won’t supply a noun, but there are few enough holes in the game I could go around manually handling each situation. So long as there aren’t two in any location. This seems best so far, because it means the player can type DIG HOLE to DIG in general, which doesn’t work the way the game is now.

  2. I could do something with regex in circumstances. Seems too fiddly, circumstantial, I have to change the code if I change the grammar, etc.

  3. Uh, your idea here, in case its better than my number 1.

Thanks for any input.

-Wade

1 Like

In other words, you need an Inform 7/10 equivalent of TADS/adv3Lite Unthing, which (or whose) reacts to the verb accordingly, replacing itself with the appropriate container (the hole, containing whatever you want inside it (hopefully not the stereotypical pirate’s treasure chest :smiley: ) ?

Best regards from Italy,
dott. Piergiorgio

Here’s something I’ve done before. It sounds like you already have a transitive >DIG [SOMETHING] action as well as an intransitive >DIG action. You can add this:

Specific digging is an action applying to one topic. Understand "dig [text]" as specific digging.

Instead of specific digging:
    try digging.

This was originally intended to cover inputs like >DIG IN GROUND or >DIG WITH SHOVEL, not knowing what a player’s intuitive input would be. But I believe it would have the desired behavior in your case: >DIG HOLE will get interpreted as a transitive digging action in the presence of a hole, and in the absence of a hole it’ll get interpreted as “specific digging” and get redirected.

3 Likes

Ah, thanks, this sounds good. I think the only potential issue may turn out to be a non-issue in practice; I’ll just have to try it. I have a lot of Before and Instead of doing anything other than… yada rules. So I have to make sure a new action for one of the fundamental actions doesn’t slip around them. Or is written so that it doesn’t.

-Wade

The third option is you add an invisible “hole” object, either as floating scenery or something added to scope. Then you make sure it goes away when there’s an actual hole in the room.

You also have to make sure that the actual holes response to DIG HOLE with something anodyne, like “Someone’s already dug here.”

2 Likes

Hm, I think this floating invisible hole sounds a bit astrophyiscally menacing, but in less esoteric talk, I think what’s potentially yucky about it is that I’d probably want it to pretend that it’s not actually seen, except when digging. So I think I’d be spoofing the ‘I can’t see any such thing’ message. AndI’d also be nervous of some weird leak coming up in some situation. It would be like Fawlty Towers. ‘Don’t mention the hole. I mentioned it once but I think I got away with it.’

However, it is another approach to add to the arsenal.

-Wade

I did a quick test and this seems to cover most of it:

To decide what action name is the action-to-be: (- action_to_be -).

Vague digging is an action applying to nothing. Understand "dig" as vague digging.

Digging is an action applying to one thing. Understand "dig [something]" as digging.

The hole-to-be is a thing. Understand "hole" as the hole-to-be. Does the player mean digging the hole-to-be: it is unlikely.

Rule for deciding the scope of the player when the action-to-be is the digging action: place the hole-to-be in scope; continue the activity.

Before digging the hole-to-be: try vague digging instead.

I just used a “does the player mean” rule to de-prioritise the hole-to-be rather than testing if a real hole is in the location; if this produces displeasing results then you might need something more subtle.

4 Likes

Thanks Adam. This code showed me another way to use scope.

-Wade

1 Like