Getting around Inform's basic "but you're already on the..."

  1. I’ve got a stationary bike.
  2. “ride bike” or “ride” enters the bike.
  3. “pedal bike” operates the pedals, but…
  4. to account for colloquial use I think “ride bike” should ALSO operate the pedals when the player is on the bike.

I haven’t been able to find a way to get out in front of the basic rules response:

I’ve had several solutions which compile properly (first before entering the bike… if the player is in the bike; instead of entering the bike… if the player is in the bike, etc.), but nothing seems to change this output. I don’t know if the “rule for” construction can be useful in this case… it’s a bit of a mystery to me. I can’t seem to figure out the approach. Any ideas?

This is super bare bones but should give you the right idea:

[code]The bike is in the cellar. It is a vehicle.

Riding is an action applying to one touchable thing.

Understand “ride [something]” as riding.

Carry out riding: try entering the noun instead.

Instead of riding the bike while the player is in the bike: try pedaling the bike.

Pedaling is an action applying to one visible thing.

Does the player mean pedaling the bike: it is likely.

Understand “pedal [something]” as pedaling.

Report pedaling the bike: say “You pedal the bike.”[/code]

Hope it helps!

Understand "ride [something]" as pedalling when the player is on the bike.
Understand "ride [something]" as entering.

Caleb, your solution compiled, but didn’t change the standard response.

JRB, your solution didn’t compile.

This is a strange one…


That’s odd, I copied and pasted Caleb’s solution and it seems to work fine. jrb’s also works, but it’s not “on the bike”, it’s “in the bike”, since the bike is an enterable object. Perhaps you have some other code that’s inadvertently getting in the way of the entering and pedaling?

Ah yes, sorry; you need Rideable Vehicles by Graham Nelson if you want to be on a vehicle. (Though if the bike is permanently stationary it doesn’t have to be a vehicle, I guess.)

Also, I used the British spelling “pedalling”; possibly your code has “pedaling”?

JRB, I traced the compilation issue with your script to spelling on pedaling. I did it with one “l” in my definition, your addition had two, so inform didn’t know what I was talking about. When I conformed the spelling it compiled properly, but still didn’t do the trick.

Here’s my working theory right now. I have only two statements in my code that deal with “riding”:

Can Inform process both at the same time? I think the first one (simpler) is the only one being used, or perhaps it takes precedence because of some inform rule. That explains the “you are already in the bike” response. Is there some version of “understand” that can use an if/then structure? Then I could test for the player’s location and be sure that it was being accounted for.

What if you try making both Understand lines specific?

Understand "ride [something]" as entering when the player is not on the bike. Understand "ride [something]" as pedaling when the player is in the bike.

…however, I do think Caleb’s solution is a good idea; rather than try to map “ride” directly to an action, you can give it its own action, whose function is to redirect to the appropriate action in the appropriate circumstances. (You would need to not have the statements for understanding “ride” as entering for Caleb’s solution to work–in his code it’s the “Carry out riding” rule that does the job of having the player enter the bike.)

It works for me.

"Pedaling" by JRB

Garage is a room. The bike is a vehicle in Garage.
Rule for printing room description details of the bike: do nothing.

Pedaling is an action applying to one thing. 
Report pedaling the bike: say "Vrrrrrrrrm!"

Understand "ride [something]" as pedaling when the player is in the bike.
Understand "ride [something]" as entering.

Edit: now I think about it, pedal bikes don’t really go vrrrrrm. But never mind.

Still doesn’t work, even when I comment out my entire “instead of pedaling the bike” function. The report function doesn’t generate a result at all–Inform defaults to the standard response “But you’re already on the bike” At this point all I can think is that:

a) I’m using Version 1.65 (1.65.1), and
b) I’m missing an extension or included file that everybody else is using


Here’s a question:

Is there some sort of debugging mode that can reveal which functions are being called in real time? Or is that kind of thing made impossible by compiling?

If you post your code—or at least enough of it to a) compile and b) show up the problem—maybe we’ll be able to see what’s going on.

Yes, there are debugging options in the IDE. Typing “rules” will report which rules are being consulted. And “actions” will tell you how Inform is converting the typed commands to actions. There are several other useful ones: see Chapter 24 of Writing with Inform.

I’ll check that rules thing.

I started trying to comment things out to isolate the trouble, but pulling that thread broke the compile, so I’m not sure what I could do other than post the entire thing. That’s more trouble than any of you should have to go through.

Anyway, I’m cleaning up some other code right now, rearranging things, simplifying–maybe that will help me find the trouble. If I haven’t figured this out in a few days, I’ll check in again.

For what it’s worth, here’s what the “RULES” command got me:

ride bike
[Rule “after deciding the scope of the player” applies.]
[Rule “declare everything initially unmentioned rule” applies.]
[Rule “announce items from multiple object lists rule” applies.]
[Rule “set pronouns from items from multiple object lists rule” applies.]
[Rule “before stage rule” applies.]
[Rule “instead stage rule” applies.]
[Rule “investigate player’s awareness before action rule” applies.]
[Rule “player aware of his own actions rule” applies.]
[Rule “check stage rule” applies.]
[Rule “convert enter door into go rule” applies.]
[Rule “convert enter compass direction into go rule” applies.]
[Rule “can’t enter what’s already entered rule” applies.]
But you’re already on the stationary bike.

[Rule “A first turn sequence rule” applies.]
[Rule “every turn stage rule” applies.]
[Rule “Every turn during WakeUpCall” applies.]
[Rule “Every turn during alexarrives” applies.]
[Rule “A last turn sequence rule” applies.]
[Rule “notify score changes rule” applies.]

I also checked the “RULES ALL” readout. There wasn’t anything in there that conflicted with riding, entering, or the bike. But I did notice something very strange…

This showed up in the RULES ALL response for “ride bike”:

But… that text was COMMENTED in my code–just for testing purposes. When I removed the comment and played the game again, it was not mentioned in the RULES ALL response! :open_mouth:

Weird… but I’m not sure we can help if you don’t post your code.

To stop the rule from blocking you:

The can't enter what's already entered rule does nothing when the noun is the stationary bike.

I’mma guess you want this though:

Before entering the stationary bike (this is the pedal to the medal rule): if the player is in stationary bike: try pedaling stationary bike instead.

Adding (this is the … rule) just names the rule so when you use ACTIONS it will show that as the name of the rule instead of [Rule “Before entering the stationary bike rule” applies] - this is helpful if you have several similar rules on an action.