Welcome to the forum lizzard!
What you’re suggesting is probably possible, but it requires reprogramming a bunch of the underlying model for vehicles, and it might be worth thinking about whether it’s worth implementing it this way.
The first thing to mention is that vehicle behavior isn’t for the most part done by low-level magic (though making the vehicle rideable does involve some Inform 6 stuff I don’t understand). The rules involving vehicles are scattered throughout the Standard Rules, and you can find them by searching for “vehicle gone by.” Mostly, what happens is that the rules for going look to see whether the player is in a vehicle, set the “vehicle gone by” action variable when they are, and then move the vehicle instead of the player (see the “move player and vehicle” rule). There are other checks too.
So here’s a couple of things that are possibly giving you trouble:
-
The “vehicle gone by” action variable only applies to the going action, not the entering action. So when the player enters the elevator, the rules don’t try to have them enter the elevator with the wheelchair–just to get off the wheelchair and enter the elevator. My first pass at this was to do “rules,” see that the implicitly pass through other barriers rule was causing trouble, and turn off that rule for this case–but even after doing that, the entering action will move the player and not the enclosing powerchair, since there’s no provision for entering to be done in a vehicle.
-
The standard set going variables rule sets the vehicle gone by to a vehicle that the player is in–which means “immediately in.” So this will always be the innermost vehicle. If you want vehicles in vehicles, and you want to set the vehicle gone by to the outermost vehicle, you have to set a rule for that. (Rideable Vehicles adds some provisions to allow the vehicle gone by to be a rideable vehicle or animal, but it’s basically the same logic.)
-
The “can’t travel in what’s not a vehicle rule” checks to see whether the holder of the player is the vehicle gone by. If the player is on the powerchair in the elevator, and we manage to get the vehicle gone by set to the elevator, this rule will block the going action, because the holder of the player will be the powerchair.
OK, so here’s something I coded to get past these problems. For number 1, I just used an Instead rule to special-case entering the elevator while on the wheelchair (this replaces your “After” rule). For number 2, I added a setting action variables rule that finds the outermost vehicular thing and sets the vehicle gone by to that. (I think it has to be a chain of vehicular things specifically–if the player is on a powerchair that is on a platform that is in a ship, the rule will stop at the powerchair.) For number 3, I changed the rule so that it checks if the holder of the player is enclosed by the vehicle gone by.
Also, I changed “if the player is in the elevator” to “if the elevator encloses the player,” because “in” means directly in so that rule wouldn’t apply when the player is on the powerchair in the elevator.
[code]“Lift” by lizzard
Include Rideable Vehicles by Graham Nelson.
House is a room. “North of you, there’s a busy street.”
Street is north of House. “Try looking again, then you may find an elevator.”
Concourse is down from Street. “A train concourse.”
Platform is down from Concourse. “A train platform.”
Liftlandia is a region. Platform, Concourse, and Street are in Liftlandia.
The Void is a room. In The Void is the elevator.
Every turn when the location of the player is in Liftlandia, now the elevator is in the location of the player.
The elevator is a vehicle. The description of the elevator is “A spacious elevator.”
Instead of entering the elevator when the player is on the powerchair:
say “You roll your chair into the elevator.”;
now the powerchair is in the elevator.
Instead of going up when the elevator does not enclose the player and the location is in Liftlandia:
say “That’s fairly challenging since your wheels won’t make it up the stairs.”
After going up:
say " The elevator almost imperceptibly moves up. Time passes. You smell a lot of things, wishing you couldn’t. The doors open again.";
continue the action.
Instead of going down when the elevator does not enclose the player and the location is in Liftlandia:
say “Quite challenging, since your wheels won’t make it down the stairs.”
After going down:
say “The elevator almost imperceptibly moves down. Time passes. You smell a lot of things, wishing you couldn’t. The doors open again.”;
continue the action.
A snazzy powerchair is a rideable vehicle. A snazzy powerchair is in House.
The player is on a snazzy powerchair.
Rule for setting action variables for going (this is the set going vehicle to the outermost vehicle rule):
let conveyance be the player;
while the conveyance is in a vehicle or the conveyance is on a rideable vehicle:
if the conveyance is in a vehicle (called the new conveyance), now the conveyance is the new conveyance;
if the conveyance is on a rideable vehicle (called the new conveyance), now the conveyance is the new conveyance;
if the conveyance is not the player, now the vehicle gone by is the conveyance.
Check an actor going (this is the can’t travel in what’s not enclosed in a vehicle rule):
let nonvehicle be the holder of the actor;
if nonvehicle is the room gone from, continue the action;
if nonvehicle is the vehicle gone by, continue the action;
if the vehicle gone by encloses the nonvehicle, continue the action;
if the actor is the player:
if nonvehicle is a supporter:
say “[We] [would have] to get off [the nonvehicle] first.” (A);
otherwise:
say “[We] [would have] to get out of [the nonvehicle] first.” (B);
stop the action.
The can’t travel in what’s not enclosed in a vehicle rule is listed instead of the can’t travel in what’s not a vehicle rule in the check going rulebook. [/code]
OK, but!
I haven’t done anything about your second issue, riding the powerchair out of the elevator. One reason is that it’s hard to interpret player intention–when the player types “exit” do they mean exiting the powerchair or exiting the elevator? If they type “stand up” they definitely mean the powerchair, if they type “out” they probably mean the elevator, but in this case both those wind up getting redirected to exiting.
Also, the elevator doesn’t seem like it’s that vehicular. It only moves on a particular path. The power of vehicles is that they make it easy to move the way you would move anyway without getting off the vehicle. One thing that might be easier than making the elevator a vehicle, and rewriting a bunch of rules to accommodate vehicles within vehicles, would be to make an “instead of going up/down when the elevator encloses the player” rule.
BTW, the “After going up” and “After going down” rules seem too broad (unless the only way the player will be able to go up and down is in the elevator), and the messages for going up and down when not in the elevator will tell the player that they’re on wheels even if they’ve gotten out of the powerchair!