Changing player states.

So I would like for the player to have extra options available to them when dealing with monsters, like hiding, when hiding they would be invisible, but I can’t seem to get inform 7 to accept this, so far I’ve got

a person can be visible or invisible.

Understand the command "stand" as something new. 
standing is an action applying to nothing.

Understand "hide" as something new. 
hiding is an action applying to nothing.

when standing the player is visible.
When hiding the player is invisible.

I would like to change the stand command to bring the player out of hiding and make them visible again, and vice versa for the hide command, I’ve left it as “hiding is an action applying to nothing” because I can’t seem to find a way to make it apply to the player.

instead of standing: if the player is standing: say "You are already standing."; otherwise: say "You stand up."; now the player is visible.

and then do one for hiding/invisible. I’m sure there are other options as well.

Trying this gave me a problem:

Problem. In the sentence 'if the player is standing begin' , it looks as if you intend 'player is standing' to be a condition, but that would mean comparing two kinds of value which cannot mix - a person and a - so this must be incorrect.

I was trying to match this phrase:

if (player is standing - a condition): 

This was what I found out:

player is standing = a condition

It’s frustrating, I can’t get the program to identify any sort of condition along with the player, because it tries interpreting the player as the condition, that’s why I was looking for a way to change the current state of the player to something else, but I can’t seem to find out how to do that.

EDIT: It doesn’t seem to have a problem If I write

Understand "hide" as hiding.  

hiding is an action applying to nothing.

Understand "stand" as standing.  

standing is an action applying to nothing.


check hiding:
	 if the player is invisible:
		  say "You are already hiding.";
	 otherwise:
		  say "You hide.";
		  now the player is invisible.

check standing:
	 if the player is visible:
		  say "You are already standing.";
	 otherwise:
		  say "You stand up.";
		  now the player is visible.

But that doesn’t make the player invisible for some reason, the game still treats the player as visible.

There are many things wrong here. It thinks ‘standing’ refers to the action, which makes ‘player is standing’ into a nonsensical comparison between an object and an action. MTW likely meant ‘If the player is visible’.

The ‘when’ clauses in your original code aren’t valid Inform as far as I know. When clauses go after rule descriptions as in ‘carry out x when y’. It looks like you’re just trying to switch from visible to invisible, so MTW’s solution is spot on.

The choice of command and action names, however, is odd. Why does ‘standing’ equate to ‘visible’?

His solution was right, the reason it gave me a problem was because I missed adding the line “Understand “stand” as standing.”

unfortunately I still can’t seem to find out how to make the player invisible when they type “hide”.

The reason I had standing equate to visible is because the player is in the open, and not making any attempt to hide, I’m not going to keep it like this, as soon as it works I can adapt it for commands that make more sense.

Oh come on! Well I found out that it is apparently impossible to make the player invisible, so I found a way to get around this:

a person can be hiding or standing.

Understand "hide" as hiding.  

hiding is an action applying to nothing.

Understand the command "stand" as something new.  

Understand "stand" as standing.  

standing is an action applying to nothing.

check hiding:
	if the player is hiding:
		say "You are already hiding.";
	otherwise:
		say "You hide.";
		now the player is hiding.

check standing:
	 if the player is standing:
		  say "You are already standing.";
	 otherwise:
		  say "You stand up.";
		  now the player is standing.

Then you have the enemy identify the player not if they are visible, but if they are hiding or not.

“Visible” and “invisible” are terms already defined by the standard rules:

Definition: Something is visible rather than invisible if the player can see it.

You’ll run into trouble if you try to redefine them. “Hiding” and “standing” are fine.

The problem is you can’t make the player invisible (at least I never found a way), you can make objects invisible (I’m not sure the about people), but not the player, and I wasn’t even trying to redefine them at first.

I’m surprised you can do that. It’s not a property, it’s a definition. “Now X is invisible.” shouldn’t work either.

I’ve never seen that “A rather than B if…” syntax before. Nice!

You can see more about this in “6.4. Defining new adjectives” of The Inform Documentation.

Hope this helps.