Action applying to some text/Not a thing.

I’m trying to create an action that could apply to anything the user types, though only with certain text will anything actually happen.

Basically the scenes a mine; and I want the user to be able to mine walls, rocks, stone etc.
It’s not really going to be a predominant part of the story line so there is no point making objects for each one. (I could probably use a backdrop but I want to learn how to do this for future anyway).
I would like to create an action that if they happen to “mine walls” it will display some text to acknowledge what they’ve done, or if they can’t mine that thing, then appropriate text for that.

My problem is I:
A) Don’t know how to apply an action to random text, and
B) Don’t know how to have several pieces of text be referenced by one ‘label’

Through a bit of guess work this is kind of where I’m at:

Understand "wall" or "cave" or "stone" or "rock" as "[rock]". Mining is an action applying to some text. Understand "Mine [text]" as mining. Check mining: If player does not hold pickaxe, say "You need a pickaxe to do that."; If "[text]" does not match text "[rock]", say "That isn't something you can mine." instead. Carry out mining: Say "You swing your pickaxe and chip away at the [rock]. It's hard work; no wonder it's left for the slaves.".

Yeah it doesn’t run but I don’t know how to fix it.

Typically, after trawling the internet and finding nothing, resorting to asking for help, I work it out 2 minutes later…
Is this an effective solution or in this scenario would something else be better?

[Mining]
Understand "wall" or "walls" or "cave" or "caves" or "stone" or "stones" or "rock" or "rocks" as "[rock]".
Mining is an action applying to one topic.
Understand "Mine [text]" as mining.
Check mining:
	If player does not hold pickaxe, say "You need a pickaxe to do that." instead;
	If the topic understood does not match "[rock]", say "That isn't something you can mine." instead.
Carry out mining:
	 Say "You swing your pickaxe and chip away at the [rock].[Line break]It's hard work, no wonder it's left for the slaves.".

That looks good to me! One thing, though, in the carry out section you’d have to say “You swing your pickaxe and chip away at the [topic understood]”, because you haven’t defined “rock” itself as a value.

Your solution works (though note itsgallus’s caveat). However, you really might want to consider making the rock walls a scenery backdrop. Consider this:

The Mines is a region. Upper Shaft is a room in the Mines. A pickaxe is in the Upper Shaft.

The rock walls are a scenery backdrop in the Mines. Understand "wall", "cave", "caves", "stone", "stones", "rocks" as the rock walls. The description is "Rough stone, marked with deep gouges where ore has been pried loose." 

Mining is an action applying to one thing. Understand "mine [thing]" as mining.

Check mining:
	if the player does not carry the pickaxe:
		say "You need a pickaxe to do that.";
		stop.
		
Check mining:
	if the noun is not the rock walls:
		say "[The noun] [are]n't something you can mine.";
		stop.
		
Report mining:
	say "You swing your pickaxe and chip away at [the noun]. It's hard work, no wonder it's left for the slaves."

The biggest benefit is that now the player can refer to the rock walls in different ways. In your text-matching example, a player typing EXAMINE WALLS or TOUCH WALLS will be told “you can’t see any such thing.” If the rock walls are an actual object, you can handle those situations very easily.

It also means you can write rules to handle special cases if the player tries to mine something else, like say a big boulder, or a glittering seam of quartz.

As a side note, I would also recommend putting the action’s text response in a report rule instead of a carry out rule. Generally speaking, carry out is for rules that alter the game state in some way, and report is just for printing the response that the player sees. The benefit of this is you can write after rules that change the game response in special situations.

Carry out mining when the vein of gold ore is in the location:
	move a random gold nugget to the location.

After mining when the vein of gold ore is in the location:
	say "After several hours' back-breaking work, a fingernail-sized nugget of gold flakes off the wall and lands at your feet. Just a few more months of this and you'll be rich!"

Ahh I see, thanks for the clarification Itsgallus and mikegentry.

I didn’t understand the use of after rules in those situations;
I’ve just been using before/instead rules to work my way round special situations.