Is there a condition for checking whether a player is mounted?

Is there a condition for checking whether a player is mounted?
I’m using Rideable Vehicles extension.

I’ve achieved the goal by setting a variable to 1 or 0 after mounting and dismounting; I can use the variable in a condition. But I’m concerned this might not be reliable, so I’d rather check the mounted/dismounted status directly.

Thanks.

If the player is enclosed by by a rideable animal or the player is enclosed by a rideable vehicle:

1 Like

Ah… “enclosed”. Thank you.

You could say ‘If the player is carried by a rideable animal or the player is on a rideable vehicle:’ or the more generic ‘If the player is held by by a rideable animal or the player is held by a rideable vehicle:’ but these would not capture the case where, for example, the player is in a howdah which is itself on an elephant. ‘Enclosed’ will also capture cases like this where the player is ‘indirectly’ carried or contained.

1 Like

PS if this is a condition you’re going to be using a lot in your code, you might want to define it:

Definition: a person is mounted if it is enclosed by a rideable animal or it is enclosed by a rideable vehicle.

Now you can simply write ‘if the player is mounted…’

2 Likes

Thanks for the extra info. Much appreciated.

I did root around in the documentation for some time and didn’t come across this information. But I’m new to Inform so probably I just didn’t know where to look or how to interpret some of the detail.

I’m having difficulty getting this to work in 6M62. With the definition above, I get the error: “Problem. You gave as a definition ‘a person is mounted if it is enclosed by a rideable animal or it is enclosed by a rideable vehicle’: but that condition makes no sense to me, although the preamble to the definition was properly written. There must be something wrong after ‘if’.”

I tried modifying it to be
Definition: a person (called the rider) is mounted if the rider is enclosed by a rideable animal.
However, that didn’t seem to resolve the issue either.

Are you using the Rideable Vehicles extension?

Whoops! Apparently I had commented out the extension.