Can't get custom disambiguation activities to run for my new action

The standard jump action applies to nothing, so I need to replace it in order to make it possible to jump in a particular direction. However, I want to write a custom message for when the player tries to jump without specifying a direction. I guess this should activate either “supplying a missing noun” or “which do you mean” but I can’t seem to get at any of these. For simplicity I have left out any code that makes my new jump action happen. Any help much appreciated.

The player is in a room called the test room.
East of the test room is place one.
West of the test room is place two.

Understand the command "jump" as something new.

Jumping somewhere is an action applying to one visible thing.
Understand "jump [something]" as jumping somewhere.

Rule for supplying a missing noun while jumping somewhere:
	say "Missing noun."

Rule for asking which do you mean while jumping somewhere:
	say "Where will you jump to?"

I just see the standard parser request instead of either of my custom attempts (and it’s misleading because it implies jumping is for things rather than directions so a player will think it’s for jumping over objects):

What do you want to jump?

(By the way, note that ‘if you invent an action which needs to apply to directions like “north” or “south”, you need to make this apply to visible things’ which is why my new action is for things not directions.)

The closest example I can find to my problem is Walls and Noses which involves Inform 6 so I don’t understand at all; I’m hoping my problem is simpler than that.

The basic problem, I think, is that the grammar line jump [somewhere] doesn’t match plain “jump.”

You don’t actually need to replace the standard jump action; you can just define a new action that takes a noun (as a direct object) in its grammar line. That new action can be similarly named, if you don’t find that confusing.

So you can leave the standard jump action in place and still define jumping somewhere. In that case, plain > jump will give you the standard response (“You jump on the spot,”), and jump [a thing] will invoke the “jumping somewhere” action. In that case, you don’t need a rule for supplying a missing noun, or for asking which the player means; at least, you don’t need them by default to make the action work (though you can still use them if you want to for other reasons).

You can also make the understand line more specific, if you want: Understand "jump [a direction]" as jumping somewhere works, and has the added benefit that the parser will give a standard response if the player types > jump candlestick. Unfortunately, though, that makes it a little harder to give players feedback about what they can use the verb on: in that case, the standard response to > jump candlestick is “You can’t see any such thing,” even when the candlestick is present. (I think this has to do with how tokens are matched in parsing, but I’m not completely clear on it myself.)

Anyway, this short demo seems to basically do what you want:

The Bedroom is a room. "Alas, this is where you sleep." A candlestick is in bedroom. Hallway is east of Bedroom. "A plain old hallway."

Jumping somewhere is an action applying to one visible thing.
Understand "jump [something]" as jumping somewhere.

Check jumping somewhere:
	if the noun is not a direction:
		instead say "You can only jump in a direction, not over objects, in this game.";
	let dir be the noun;
	let newPlace be the room dir from the location of the player;
	if newPlace is nothing:
		say "You bang your head into the wall." instead. 

Carry out jumping somewhere:
	try going the noun.
Before jumping somewhere:
	if the noun is a direction, say "You leap nimbly to [the noun].".

Notice that it intentionally uses a before rule to report the results of the action, making its own check to see if the action is going to succeed; this is because you probably want the action report to come before output the new-automatically-generated-looking action in this case. (But if there might be doors in the way, or if just using the going action won’t work, you may need to modify that.)

1 Like

This was a great answer, thanks. I’m doing it as you suggest just leaving the existing jump action in place.

1 Like

Glad to be helpful!