Cannot refer to the after rulebook

I have this code that plays with the pushing it to action. It does some overriding of the standard behavior, which you can mostly ignore. Here’s the code:

Lab is a room. 
Garden is south of Lab.

The teddy bear is in the box. The box is in the lab.
The dynamite is in the box.

The box is pushable between rooms.

After pushing something to (this is the foo rule):
	say "foo";
	continue the action;
	
After pushing something to (this is the bar rule):
	say "bar";
	continue the action;

		
Check pushing something to (this is the new standard pushing in directions rule):
	continue the action;
	
push successful is a truth state that varies.

Carry out pushing something to:
	silently try the actor going the second noun;
	if the rule succeeded:
		now push successful is true;
		now the noun is in the location;
		now the noun is handled;
	otherwise:
		now push successful is false;
		rule fails;

After pushing something to (this is the push message rule):
	if push successful is true:
		say "You push [the noun] to [the location].";
		try looking;
		continue the action;
	
The new standard pushing in directions rule is listed instead of the standard pushing in directions rule in the check pushing it to rules.
The block pushing in directions rule is not listed in any rulebook.

The push message rule is listed first in the after pushing it to rules.

This doesn’t compile. I’m told “you gave ‘the after pushing it to rules’ where a rulebook was required.”

That’s strange, because the check pushing it to rules is a legitimate rulebook. Shouldn’t after follow the same naming rule?

You can just say:

The push message rule is listed first in the after rules.

The IDE index is a little unhelpful in identifying rulebooks, so I find in situations like this Zed’s site listing the standard rules is a godsend; just go to the Standard Rulebooks section and look for the one you’re after.

I’m not sure what’s going on with the check rule/rulebook – that rule doesn’t appear to show up under the check rulebook in the IDE index when I compile this code so something wonkier might be going on? Will let wiser heads than mine consider what’s going on.

2 Likes

Okay, I did a little more experimentation, and there are per-action rulebooks for check, carry out, and report, but not for before, after, and instead. The rulebook you mention above is the rulebook covering all after rules. It’ll work, but it’s a bit of a blunt instrument.

A interesting fact I turned up is that if you, for instance, list an after rule in the check rulebook, it will still have the default successful result, and thus make the check rules, and hence the entire action, stop. So yeah, don’t cross-list rules like that.

You can say

The standard pushing in directions rule is not listed in any rulebook.

to deactivate it; you don’t need to create an empty rule to replace it.

You can say

First after pushing something to (this is the push message rule):

to specify its primacy.

But per Pushable not behaving as I expected it to I think this is all you need for what you want:

Lab is a room. 
Garden is south of Lab. "Gardenous."

The teddy bear is in the box. The box is in the lab.
The dynamite is in the box.

The box is pushable between rooms.

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

For efficiency reasons, “check”, “carry out”, and “report” are implemented as a separate rulebook for each action, while “before”, “instead”, and “after” are one big rulebook for everything.

1 Like

Yeah, I was getting way over-complicated there. I would add one thing, though, to make sure the thing pushed gets listed in the new location:

After going a direction (called way-pushed) with something (called the thing-pushed): 
    say "You push [the thing-pushed] [way-pushed] to [the location].";
    now the thing-pushed is handled;
    now the thing-pushed is in the location; [added]
    continue the action.

The reason I originally asked the question was to interleave other messages between the push message and the room description. So that’s why I needed to reference the after rulebook:

Lab is a room. 
Garden is south of Lab. "Gardenous."

The teddy bear is in the box. The box is in the lab.
The dynamite is in the box.

The box is pushable between rooms.

After going a direction (called way-pushed) with something (called the thing-pushed) (this is the standard after push rule): 
    say "You push [the thing-pushed] [way-pushed] to [the location].";
    now the thing-pushed is handled;
    now the thing-pushed is in the location;
    continue the action.

After going to the garden with the box for the first time (this is the nice garden message rule):
	say "Everyone in the garden turns when they see you push the box in.";
	continue the action;

The nice garden message rule is listed after the standard after push rule in the after rules.

Thanks for pointing me to a simpler way to do the push message!

As a side note, you don’t need to assign your own names to the direction and the object pushed. The direction gone is “the noun” and the item pushed is “the thing gone with”.

In general, anything that shows up in an action pattern like that is an “action variable” that can be accessed directly in any rules about that action. The standard action variables are the noun, second noun, and actor, but e.g. for going there’s also the room gone from (“from”), the room gone to (“to”), the door gone through (“through”), the vehicle gone by (“by”), and the thing gone with (“with”). You can find these names in the Standard Rules and also, I believe, in the Index under that action’s heading.

3 Likes