Pushable not behaving as I expected it to

Things which are pushable between rooms are not described on the same turn they are pushed, as I was expecting them to be. A minimal example is:

"Push Toy" by Mike

The story headline is "An Interactive Mystery"

The Main Room is south of the Other Room. "Test 1."
The Other Room is a room. "Test 2."

The toy is a thing in Main Room.
The toy is pushable between rooms.

Running this example through the Linux IDE gives this output:

Push Toy
An Interactive Mystery by Mike
Release 1 / Serial number 211203 / Inform 7 build 6M62 (I6/v6.33 lib 6/12N) SD

Main Room
Test 1.

You can see a toy here.

>push toy n

Other Room
Test 2.

>look
Other Room
Test 2.

You can see a toy here.

where I was expecting to see the toy described in both “Other Room” descriptions, not just the second. It is present in the first turn, though - showme or examine can see it. This is the smallest example I could pare it down to, but it’s not specific to it - the same behaviour can for example be seen in Disenchantment Bay 12 (with the ice chest).

Is this intended behaviour? If so, can anyone recommend a way to get a pushable thing that announces itself each time it is pushed into a new room?

2 Likes

I think this could be considered a bug. The Pushing it to action gets converted to the I6 routine:


[ ConvertToGoingWithPush i oldrm newrm infl;
        i=noun;
        if (IndirectlyContains(noun, actor) == false) { move i to actor; infl = true; }
        move_pushing = i;
        oldrm = LocationOf(noun);
        BeginAction(##Go, second);
        newrm = LocationOf(actor);
        move_pushing = nothing; move i to newrm;
        if (newrm ~= oldrm) {
                if (IndirectlyContains(i, player)) TryAction(0, player, ##Look, 0, 0);
                RulebookSucceeds();
        } else RulebookFails();
        rtrue;
];

So the Going action is complete before the item is actually considered to be in the new room. And the look that actually happens is part of the Going action; the IndirectlyContains is false.

The following makes this case look better:

report going when the item-pushed-between-rooms is not nothing:
say "[The actor] [push] [the item-pushed-between-rooms]."


After going when the item-pushed-between-rooms is not nothing: 
move the item-pushed-between-rooms to the location;
continue the action.

But I’m a little nervous it might break something else I’m not thinking of.

3 Likes

It’s not a bug; this behavior has been consistent since I6.

I am a bit of a newb, forgive me.
What is ##Go ?

Is it a variable? What is the significance of the ‘##’?

That’s a bit of Inform 6 code – the “##” indicates that what’s being referred to there is the name of an action. See relevant bit of the DM4.

2 Likes

My apologies; I went straight to talking about things that are deeply in the weeds. Your Inform 7 source code gets compiled to Inform 6 and that’s combined with a bunch of other I6 code from the “I6 Template Layer” to make the auto.inf file you can see in the project Build directory after compilation, and then that gets compiled to either a .ulx or .z8 file. The ConvertToGoingWithPush routine I included above is from Actions.i6t from the Template Layer.

I would suggest not trying to worry about these details yet; there’s plenty to learn and think about before you get to I6-level stuff.

But that doesn’t mean you’re not affected by it… because the Pushing It To action is implemented in an irregular way, there are things you can’t change about its behavior in the same way you would other actions. The order of the standard Action rulebooks is: Before, Instead, Check, Carry Out, After, and Report. It’s a Check rule that converts the action and so there’s never any attempt to follow Carry out, After, or Report rules for Pushing It To. What you can do is what I did above: create rules for the Going action with a when the item-pushed-between-rooms is not nothing condition. (And this isn’t documented; one could only know the details here by reading the Standard Rules and template layer.)

3 Likes

This line is from the "Mattress King" example-- quite similar to Zed’s. I assume (hopefully rightly) that if code is from the documentation, it won’t break anything else.

After going a direction (called way-pushed) with something (called the thing-pushed): 
    say "You push [the thing-pushed] [way-pushed] to [the location]."; 
    continue the action.
1 Like

Yes, I got a combination of these suggestions to work for me - thanks!

1 Like

… and is explained in the documentation as being designed to avoid the repeated announcement e.g. ‘You can see a wheelbarrow here’, as if it were a surprise, after pushing said object sequentially through a series of rooms.

1 Like