Surprise, the dumb n00b has another question

Okay, so a basic feature of vehicles – that they can be in rooms, and that you can be in or on a vehicle and in a room at the same time – seems to not be working.

From now on I’ll just post in this thread when I have a dumb question.
dang wheelchair.PNG
dang wheelchair error.PNG
documented vehicle.PNG

As it says, you’re trying to put the player in the Extraction Room, but also in the wheelchair. Remove one or the other.

Just to be ultra-clear, a human reader will understand that the player is both in the room and in the wheelchair – but in spite of appearances to the contrary, Inform doesn’t think about things the way a human does. When specifying facts of this sort (containment relations and so on), you need to be aware that you’re speaking to a computer (specifically, to the Inform compiler), not to a fellow human. The compiler is capable of making a number of sophisticated assumptions, but each and every assumption that it makes is the result of hard computer code. It can’t make inspired guesses the way a human would.

Okay…nevertheless, the wheelchair must needs be in the extraction room. The rules are supposed to allow that, if I’m not mistaken. How do I fix it?

[code]Extraction room is a room.

The wheelchair is a rideable vehicle. It is in the extraction room.

The player is on the wheelchair.[/code]

That’s really all that should be required. Make sure you don’t have any typos, or contradictory statements elsewhere in the code.

Yeah, you don’t want to say “The player is in the Extraction Room” because to Inform, what that means is “The player is directly in the Extraction Room and is not in or on anything else within the room.”

Thank you, mikegentry and bg, that worked!

(Since this is likely to come up again: “in”, for Inform, generally means “directly inside”. If you need to check if something is anywhere inside the room, even if it’s in another container sitting on a table, then use “enclosed by”.)

So, I wrote this code:

Instead of getting off the wheelchair:
say “With sudden hope in your chest, you rise shakily to your feet. In a few steps your heart begins pattering frantically in your chest and your feet stumble, throwing you onto your hands and knees. You have no choice but to crawl back into the wheelchair.”

The game says

get off wheelchair
You dismount the wheelchair.

What gives?

You can use the “actions” testing command to see what the name of the action is.

[rant=Incorrect, ignore this]I believe “get off [something]” is the “exiting” action, so you need to say “instead of exiting the wheelchair…”[/rant]

On my test (at least on the version that’s up on Playfic), “get off” is the getting off action… if there weren’t a getting off action then “Instead of getting off the wheelchair” wouldn’t compile. And the code is working as intended:

[code]Lab is a room.

The wheelchair is an enterable container in the lab. The player is in the wheelchair.

Instead of getting off the wheelchair:
say “With sudden hope in your chest, you rise shakily to your feet. In a few steps your heart begins pattering frantically in your chest and your feet stumble, throwing you onto your hands and knees. You have no choice but to crawl back into the wheelchair.”[/code]

Though maybe this is down to a different version of Inform–Playfic runs 6G60. In any case, testing with “actions” is a good idea.

iconodule, can you post more of your code, preferably enough to compile by itself and demonstrate the problem? That makes it easier to see what’s going on. For instance, it makes a difference whether the wheelchair is a supporter or a container (if it’s a container then the player can get out by typing “exit,” which will invoke the exiting action).

Also, if you could, it’d be easier on my eyes if you typed everything in normal black–the shade of pink you use turns an especially eye-watering color under the program that dims my screen at night so I can fall asleep after looking at it. You can set off your code by using the “code” button above where you type your post (it’s in between “Quote” and “List”)–that also makes it much easier to copy and paste your code from your post to check what’s happening. Thanks!

Stray thought: I’ve never seen Inform’s default say “You dismount…” anything. Do you possibly have the extension Rideable Vehicles installed?

The wheelchair is an enterable container in the lab. The player is in the wheelchair.

In that case, you’ve defined the wheelchair as a container. You need to make it a rideable vehicle and place the player on the wheelchair I would believe to use the “getting off” action.

On second read…it’s a Playfic joint so no extensions. Hm.

Exactly what I was thinking, too.

Either way, lisiting ACTIONS would help to identify it.

That was me who used Playfic to define the wheelchair as a container, not the person with the original question. (I wanted to try some working code and I didn’t have Inform up and running.)

The Rideable Vehicles extension creates two new actions: mounting and dismounting. The entering, exiting, and getting off actions all get immediately converted to mounting or dismounting actions when applied to rideable vehicles, so your “instead of getting off the wheelchair” rule never gets a chance to happen. You want:

Instead of dismounting when the player is on the wheelchair: say "With sudden hope in your chest, you rise shakily to your feet. In a few steps your heart begins pattering frantically in your chest and your feet stumble, throwing you onto your hands and knees. You have no choice but to crawl back into the wheelchair."

Note, the dismounting action doesn’t take a noun. So you have to add the condition “when the player is on the wheelchair” to make sure the game doesn’t give the same message when you try to get off a horse or a motorcycle or what have you.

Good observation. I do indeed have it installed – I apologize, I should have mention it beforehand.

I’ll try mikegentry’s latest suggestion now.


rideable vehicle.PNG

Well, one verb is working at least. Pretty sure the other ones should work too.
results.PNG

If you take another look at the index page for the getting off action, you’ll see two other rules: “before getting off a rideable vehicle” and “before getting off a rideable animal”. Those are supplied by the Rideable Vehicles extension (you can tell that from the orange ‘e’ icon next to them), and they’re what converts the getting off action to dismounting. (There are similar rules in the page for the exiting action and the page for the entering action.)

Note that they’re in the “before” section of the action-processing rules, which means they get checked and run before anything you put in the “instead” rules.

The exiting and dismounting actions are not set up to take nouns. (I don’t know why the standard rules are set up this way and honestly it drives me a little bit bonkers, but whatever.) So Inform will understand EXIT and DISMOUNT, but not EXIT [something] or DISMOUNT [something].

Fixing for this is not too complicated, once you understand how actions and grammar work.

First, get rid of your line ‘Understand “exit” and “get off” as dismounting.’ That doesn’t add any functionality to your game, because “exit” and “get off” (without a noun) are already understood as exiting, and that automatically gets converted into the dismounting action anyway.

What you want is to make Inform understand that EXIT [something] and DISMOUNT [something] means DISMOUNT. Unfortunately, the dismounting action will not accept a noun (and you can’t make it do so without stripping it out completely and rebuilding it from scratch). So instead, we employ a bit of misdirection.

Understand "exit [something]" as getting off. Understand "dismount [something]" as getting off.

The getting off action does take a noun. This means that we can define grammar lines for it that include a noun token. (That’s what the ‘[something]’ is.) So these two grammar lines now invoke the getting off action – which will immediately get converted to the dismounting action, which gets the player off the chair.