Report pushing between rooms? [I7]

I’m having trouble coming up with the right syntax for this. I have an object that’s pushable between rooms, but can’t figure out how to write a report rule for when this happens.

Parking Lot is a room. Lonely Street is west of the Parking Lot.

The dumpster is an enterable container in Parking Lot. it is pushable between rooms.

Report pushing the dumpster to somewhere (called the trashy place):
	say "Grunting and sweating, you push the dumpster to [the trashy place].".

The report rule doesn’t fire here. Watching what’s going on with ACTIONS shows that PUSH DUMPSTER WEST is being converted into a going action, but I’m not sure how to write a report rule for going that only triggers when pushing the dumpster.

This is far beyond my depth, but I think what’s happening is that Inform is converting the PUSH DUMPSTER TO WEST command into a special “going-with-push” action, so since the action doesn’t complete the Report rule doesn’t fire (I’m basing this on Appendix A to the documentation, which is the robustly-commented Standard Rules – mentioning that specifically since I don’t think it’s part of the standard documentation but I’ve found it to be really useful!)

I thought based on that that changing the Report rule to a Before rule would do the trick, but unfortunately it didn’t. Interestingly, if you hard code the rule, it does work, though:

Parking Lot is a room. Lonely Street is west of the Parking Lot.

The dumpster is an enterable container in Parking Lot. it is pushable between rooms.

Before pushing the dumpster to the west when the player is in the parking lot:
	say "Grunting and sweating, you push the dumpster to the Lonely Street.".

Gives the output:

>push dumpster west
Grunting and sweating, you push the dumpster to the Lonely Street.

Lonely Street

So that’s progress, though obviously hard-coding isn’t great. I am really an Inform newbie so sussing out why what appears to be a perfectly cromulent text substitution isn’t working is beyond my ken, but hopefully this is at least a little helpful!

Edited to add – oh, maybe what’s going on is that the player is pushing the object to a direction, not to a place? Yes, in fact this works!

Before pushing the dumpster to a direction (called foo):
	say "Grunting and sweating, you push the dumpster to the [foo].".

If you want it to say the new location name and not the direction that will take a little bit more work, but I think this basically cracks the nut!

1 Like

You can do this:

Report going to somewhere with the dumpster:
	say "You push the dumpster to [room gone to], direction [noun].";
4 Likes

with the dumpster is precisely the phrasing I couldn’t quite come up with. Many thanks, zarf.

I had a similar problem with an after rule for pushing the dumpster, too. Weird. But rolling that after rule into the report going to somewhere with the dumpster works fine. I’ll have to play a bit and see if I can disentangle that.

Thank you, Mike!

One thing that sometimes happens to me is that I write an After rule with a condition that applied at the beginning of the action… but the Carry Out rules changed the condition!

So if the Lonely Street is west of the Parking Lot, and you want to write a rule that applies to going from the Parking Lot to the Lonely Street, this might work:

Before going west when the Player is in the Parking Lot:

but this will not:

After going west when the player is in the Parking Lot:

because by the time the “after” rule runs the player isn’t in the Parking Lot anymore!

Things like “to,” “from,” “with,” etc. shouldn’t encounter these problems, because they’re abbreviated ways of referring to action variables like “room gone from” “room gone to” and “thing gone with.” Those get set at the very beginning (in the setting action variables rules), and they will stay the same throughout the processing of the action.

1 Like

That is … almost certainly it. I had gotten around it by wrapping the after logic into the report rule, but I’m going to check and see whether that fixes the problem in a better way when I’m back in front of my laptop.

Thank you!

1 Like