Using "Examine" Command, but cannot "Examine"

I have a character that is blindfolded. So when a user inputs “Examine”, I want to be able to say, “You cannot see the tunnel. Did you forget that you are blindfolded?”

This is what I used:
Instead of examing the tunnel:
say “You cannot see the tunnel. Did you forget you are blindfolded?”

Test me with “examine tunnel”.

I am still getting: You can’t see any such thing.

Thank you for any assistance.

1 Like

This works in a small test game project. (If you spell “examining” correctly, that is.) And if the tunnel object is in the room!

If the tunnel isn’t present, the player can’t examine it.

Are you using some darkness effect to keep objects out of play when blindfolded?

Thank you for your reply. As you can see I am very new at this. What I have is the following:

[Tunnel]
Tunnel is a room.

Instead of examining the tunnel:
say “You cannot see the tunnel. Did you forget you are blindfolded?”

So question now is: Do I have to make “Tunnel” an object?

What about using [something]?

Instead of examining [something]:
say "You can’t see anything. Did you forget you are blindfolded?

If I’m getting the Inform 7 right, that would cover any attempt to perceive anything at all.

(edit): I think the problem is that the system checks for the existence of the target before it even checks for the Instead rule. If there’s no object, it fails by saying it doesn’t exist. I think using [something] will pass as long as there’s a text string after examine, so the existence of that thing won’t matter.

1 Like

The [something] here is actually doing nothing at all—text in square brackets outside a text string is a comment, so the compiler ignores it completely!

The trick is, Inform considers “examining” and “examining something” to be the same, so “instead of examining [something]” works completely by accident: the [something] gets removed, but “instead of examining” is a perfectly legal rule header on its own.

2 Likes

That’s the easiest way forward, yes. Rooms are not in scope by default. This means that the player can’t apply any verbs to rooms.

You can mess around with the scope rules, but it’s easier to create a scenery object to represent the tunnel.

1 Like

I’d assumed the documentation keeps them there as a reminder. Thanks for pointing out the reality.
(edit) Double-checking - it’s the quotations that are needed to make bracketed words functional, yes?

I made an attempt at coding an example. See my post further down (mileage may vary).

1 Like

Excellent. Thank you everyone for your fast response. It will take me awhile to learn but it is enjoyable. Thank you Interactivefiction for the help. It worked pretty well.

Did a little more with this and added a container with a hidden object in it to be certain that searching objects (versus rooms) works as expected.

A blindfold is a thing. The description is "It is a black cloth blindfold."
Tunnel is a room. The description is "This is a long tunnel carved from stone."
A chest is an openable closed container in the Tunnel. The description is "It is a wooden chest."  
The chest contains a glass sword.  The glass sword is undescribed.  
The description of glass sword is "This is a glass sword, almost invisible to the eye."

Understand "examine [any room]" as searching.
	
Instead of searching:
	If the player is wearing a blindfold:
		say “You cannot see the [location]. Did you forget you are blindfolded?”;
		stop the action;
	If the noun is an open container:
		Now all objects in the noun are described;
		continue the action;
	continue the action.	
	
Instead of examining anything:
	If the player is wearing a blindfold:
		say “You cannot see the [noun]. Did you forget you are blindfolded?”;
		stop the action;
	continue the action.	

Instead of looking:
	If the player is wearing a blindfold:
		say “You cannot see the [location]. Did you forget you are blindfolded?”;
		stop the action;
	continue the action.

After taking off a blindfold:
	try looking.

The player wears a blindfold.  	

This basically plays out as follows:

You cannot see the Tunnel. Did you forget you are blindfolded?

>l
You cannot see the Tunnel. Did you forget you are blindfolded?

>examine tunnel
You cannot see the Tunnel. Did you forget you are blindfolded?

>examine blindfold
You cannot see the blindfold. Did you forget you are blindfolded?

>remove blindfold
Tunnel
This is a long tunnel carved from stone.

You can see a chest (closed) here.

>examine chest
It is a wooden chest.

>search chest
You can't see inside, since the chest is closed.

>open chest
You open the chest, revealing nothing.

>search chest
In the chest is a glass sword.

>examine sword
This is a glass sword, almost invisible to the eye.

Made a quick edit based on Andrew’s suggestion, it works well and causes the player to look at the current room in response to removing or taking off the blindfold.

You cannot see the Tunnel. Did you forget you are blindfolded?

>take off blindfold
Tunnel
This is a long tunnel carved from stone.

You can see a chest (closed) here.

Additional edit to prevent the objects in the container from being made visible by searching the chest while it is closed.

You might want an “After removing the blindfold: try looking” rule.

2 Likes

A good idea! Question for you, would cases for when player is blindfolded be better in Before statements versus Instead? I read that Instead is really for blocking actions and that the combination of Instead + continue the action should be written as a Before statement.

Made the edit and tried it out, works great :slightly_smiling_face: