Understand any command as an action

Is there a way to understand any command (a random text or even nothing) as an action?

Something like: understand “[anything]” as looking.

Can you say a little more about what behavior you’re trying to get here? This seems like it could be deeply confusing to the player and create lots of headaches for you.

With that said, there are two basic approaches that come to mind. If you want to reroute valid commands to looking, you’d make a rule like this (I added a couple common commands to the exceptions list since I assume you’ll do at least a few things other than looking in this game!):

Instead of doing anything other than looking or taking or dropping, try looking.

For invalid commands, the route would be to use the responses system, like so:

The parser error internal rule response (N) is "[looking-redirect]".

To say looking-redirect:
	Try looking.

Doing this for incompletely-understood commands would be a lot of work, since there are a ton of responses in the standard rules (see this section and following in the docs).

Again, I’d be very careful with doing anything like this and wouldn’t mess with the default behavior unless there was a very very very good reason to do so!

1 Like

The third approach, if you want to entirely ignore what the player typed and just do your own thing, is an “after reading a command” rule. (Manual chapter 18.33.)

After reading a command: 
	replace the player's command with "look".

But again, you have to be careful, because this stomps on SAVE, RESTORE, UNDO, and QUIT as well as in-game commands.

3 Likes

Or the classic trick where whatever keys the player presses, it comes out as >LOOK.

Yes, I am sorry. This was exactly what I was looking for. I must have missed it in the documentation. Of course I only want to use in a specific turn of the game, so no big issues.