Using an Extension

Ok. I added this:

Include Rideable Vehicles by Graham Nelson.

Because I have a horse I want the player to be able to ride.

But I’m having a heck of a time doing anything with it.

I certainly don’t seem to be able to override the check and carry out code for riding. I kind of wanted my own conditions and responses (maybe the white horse is too mean to ride?)

Even this didn’t work, which I find baffling (not that it’s a good way to do it):

Instead of riding the black horse: say "Yee ha! You're riding the horse.".

“Ride horse” is a legal command and gives me Graham’s built in response.

I guess when you use an extension you can’t modify it?

Why do I want to change it? Well it doesn’t seem to be doing anything for me that I need to do:

[code]>Get on horse
You mount the black horse

Ride east
You must name something more substantial

Ride horse
You are already riding the black horse[/code]

These all strike me as unintuitive responses … sort of giving the impression that one is riding in place as if on a treadmill. Must mounting equal riding?

Assuming I want to re-code this myself… can I simply make the horse “enterable” so one can sit on it? I couldn’t get that to work. I considered making it a vehicle but didn’t know if that would have unintended consequences, and I guess that would still make it something you get “in” rather than “on” (thus the inspiration for Graham’s Rideable Vehicles).

The verb for riding is actually mounting.

The black horse is a rideable animal in Wherever The Horse Is. After mounting the black horse: say "Yee ha! You're riding the horse.".

You’ve got a lot of complicated issues packed into this post, ShaeSays. chinkeeyong was right on which verb (mounting) to use, but there’s more than that going on here.

If you look in the “Actions” section of the “Index” tab in your project, the third section (“Commands available to the player”) lists all the synonyms for verbs in the game. Looking there we see that “ride” is a synonym for the “mounting” action (as chinkeeyong rightly noted).

If you change the example you gave to use the correct action, though, you’ll also want to get rid of the Instead rule (again as chinkeeyong noted) since this would mean you never actually get a chance to mount the horse; the Instead rule you used directly prevents any attempt to do so. To make things even more confusing, if for some reason the “Instead of riding the black horse” rule did work, it would crash your game when you tried to ride the horse since you’d be saying “Instead of riding the black horse, try riding the black horse.”

Sure you can, but some ways are better than others. If you really wanted to, you could just open up the extension and directly change it in any way you want by adding, deleting, or changing stuff. This is a bad idea, however, for several reasons:
–if you make direct changes to an extension and then need to ask questions on the forum about some code that relies on the extension in some way, no one will be able to figure out what’s going on since your version of the extension will be different from everyone else’s version;
–if you release a game along with all the source code and extensions used, the author of the extension will probably be concerned and possibly very upset to see that they are listed as the author of stuff they didn’t write.

The best way to modify extensions is to use procedural rules in your own code. For example, although it’s a minority view I really dislike implicit actions. The “Locksmith” extension included with Inform 7 is very useful, but contains lots of implicit actions. For example, the first rule listed in the Locksmith extension is:

Before going through a closed door (called the blocking door) (this is the opening doors before entering rule): if using the sequential action option: try opening the blocking door; otherwise: say "(first opening [the blocking door])[command clarification break]"; silently try opening the blocking door; if the blocking door is closed, stop the action.
If I don’t like this rule, rather than go into the extension and erase it or comment it out, all I have to do in my own code is add the following:

Include Locksmith by Emily Short. Procedural rule for going through a closed door: ignore the opening doors before entering rule.
This tells my game to ignore the rule found in the Locksmith extension dealing with opening doors before going through them. For this to work, though, the rules in the extension have to be named (for example, “(this is the opening doors before entering rule)”) . One problem in the “Rideable Vehicles” extension is that some of the rules aren’t named, and therefore there’s no way to procedurally ignore them. In this case, you may want to open the extension, give all the rules names, and save it for your personal use; you just would never want to redistribute it to anyone in that condition.

Actually by including the Rideable Vehicles extension and defining the horse as a rideable animal, it is already both an enterable supporter and a vehicle since that’s what the extension defines a rideable animal to be.

One way to get some better responses here would be to make some empty commands that redirect to the proper action (which is the “going” action) while trying to use the horse. One complication is that directions are not “things,” so the typical way of writing a command (X is an action applying to one thing) won’t work; this is also why you got the response “You must name something more substantial” when you typed “Ride east”. For example:

[code]Riding there is an action applying to one object.

Understand “ride [direction]” as riding there.

Check riding there:
unless the player is carried by a rideable animal:
say “What do you want to ride?” instead;
otherwise:
let way be the noun;
try going way instead.

Riding it there is an action applying to one thing and one object. Understand “ride [something] [direction]” as riding it there.

Check riding something there:
unless the noun is a rideable animal:
say “You’re not riding anything.” instead;
otherwise:
let way be the second noun;
try going way instead.[/code]
These two new verbs, “riding there” and “riding it there”, don’t do much but redirect to the going action; however, they also let the player use the phrasing you want to allow.

The last parser response you were unhappy with:

Ride horse
You are already riding the black horse
is determined by a rule in the Rideable Vehicles Extension:

Check an actor mounting (this is the can't mount when mounted on an animal rule): if the actor is carried by a rideable animal (called the steed): if the actor is the player, say "You are already riding [the steed]."; stop the action.
If you don’t like that phrasing, you can change it (since this particular rule is named) in a few ways. Here’s one way:

[code]The way better can’t mount rule is listed instead of the can’t mount when mounted on an animal rule in the check mounting rulebook.

Check an actor mounting (this is the way better can’t mount rule):
if the actor is carried by a rideable animal (called the steed):
if the actor is the player:
say “Whatever ShaeSays wants to say.”;
stop the action.
[/code]
In conclusion, then, maybe we could say:
a) You can change anything you want about an extension, but
b) some ways are better (and more considerate to the extension author) than others; however
c) these better ways are not necessarily simpler ways.

As far as not being able to ride the white horse, that’s a case where it might actually be a good idea to use an Instead rule, such as:

Instead of mounting the white horse, say “He’s too mean, he’d probably throw you off just for the fun of it.”

since you really do want to block riding the white horse.

Don’t get discouraged. :slight_smile: Eventually the whole horse scenario will be exactly the way you want, and you’ll have learned a lot in the process of writing it.

Hi Endosphere,

Thanks for the response. There’s a lot to digest in your post that I haven’t tried to digest yet.

However, many of my problems stem from one fact: I didn’t know you could open and look at (or change, however ill-advised that may be) the code in the extension. How do I do that?

In windows, under the “file” menu, there’s an option to “Open Extension.” I suspect there’s some similar option for the other OSes.

Cool, thanks Mike.

Between that new info and the revelation that “mount” is the verb to manipulate, I think I can probably do what I need to do. Thanks all.

Also, extensions have documentation that describes how to use it and often how to customize its behavior. You can find them by clicking on the “Installed extensions” link on the documentation main page and then clicking on the extension’s name.

Or even better, since you’re completely disabling that rule:

The opening doors before entering rule is not listed in any rulebook.