Instead of doing anything other than... confusion

Can someone please explain to me the dynamic of Instead of doing anything other than… rules, specifically where they involve created actions that take two things??

I have such a rule that goes like this–

Instead of doing anything other than examining, spying, entering, heaving, looking under, listening to, climbing, pushing or pulling with the hanging bathtub when the noun is not bustedup:
	say "The tub is way out of your reach."

I have different Instead rules for some of those actions (such as entering and climbing), which is why they are allowed. Two of the actions on the list are created actions that require two things-- ‘Spying it through’ (‘examine bathtub through the binoculars’ is one command that leads to it), I listed it as ‘spying’; the other represents an array of actions that start with ‘heaving’–heaving it to, heaving it right, etc (‘push the bathtub to the sign’, ‘push the bathtub to the right’, ‘pull the bathtub to the left of the sign’, etc). ‘Spying’ worked perfectly. ‘Heaving’ was not allowed at all, though the compiler took the list. Every time I tried those commands in testing, it would work like this–

> push tub right

The tub is way out of your reach.

My rule for the bathtub with this action is–

Instead of heaving right the hanging bathtub:
	say "You'll have to use the crank to move it; the tub is out of your reach."

Which is what I thought would print.

In short, why would it allow the Spying it through action, and not the heaving it right action?? Could it be because there are a variety of ‘heaving’ actions in my game?? I also tried listing them all more explicitly like this–

...heaving it to, heaving it right, heaving it left, heaving it right of, heaving it left of...

–but the compiler would not take them. It would only take ‘heaving’ and none of those actions were allowed. I note that I did not have to list ‘spying’ as ‘spying it through’ for it to be allowed.

I looked all over the manual, but the manual only glosses over this as far as I can tell.

Thanks for any help.

What’s the definition for your heaving... actions?

Using it in an action name implies that the first parameter to the action should replace it when writing the action name. This is necessary for actions with two parameters, e.g. attaching it to would be for parsing commands like >ATTACH SHIPPING LABEL TO CARDBOARD BOX and would allow for rules like:

Instead of attaching something non-sticky to something:
    say "[The noun] slides off."

in which the it of the action name template (representing the first parameter, or noun) is replaced with the description something non-sticky in this case, and the second parameter (i.e. second noun, here allowed to be any thing) follows to complete the action name.

It seems like maybe you are instead defining your heaving... actions in a form like:

Heaving it right is an action applying to one thing. Understand "heave [something] right" as heaving it right.

The compiler doesn’t complain about this, but it may be causing some confusion. It means that your action names should be of the format heaving ... right (e.g. heaving something heavy right) to mean this action.

When just heaving is placed in the list of action names, the compiler seems to be allowing it based on whatever allows the syntax for two-parameter action names. (For example, it would be possible to include attaching in a list if there was an attaching it to action, and this would mean any attaching it to action regardless of the nature of the noun or second noun.) However, in your case it may be picking only a single heaving it... action to apply, instead of all of the action names that begin that way. Does one and only one of the heaving... actions trigger that rule?

The compiler doesn’t like it when you try to construct a list of action names that include actions with different numbers of parameters. EDIT: This was incorrect. It just doesn’t like it when you try to specify more than one description of action, unless doing so indirectly via a kind of action. (This is explained in the problem message when you try to mix them.) The workaround is to create a kind of action (also explained in the problem message).

If none of that is helpful, then would you be able to post a minimum working example of your code to better demonstrate the issue?

1 Like

Here are the pertinent parts of my code…

Heaving it under is an action applying to two touchable things and requiring light.  Understand "push [something] under [something]" or "pull [something] under [something]" as heaving it under.
Heaving it to is an action applying to two touchable things and requiring light.  Understand "push [something] next/-- to/onto [something]", "pull [something] next/-- to/onto [something]" as heaving it to.
Heaving it right of is an action applying to two touchable things and requiring light.  Understand "push [something] to/-- the/-- right of [something]" or "pull [something] to/-- the/-- right of [something]" as heaving it right of.
Heaving right is an action applying to one touchable thing and requiring light.  Understand "push [something] to/-- the/-- right" or "pull [something] to/-- the/-- right" as heaving right.
Heaving it left of is an action applying to two touchable things and requiring light.  Understand "push [something] to/-- the/-- left of [something]" or "pull [something] to/-- the/-- left of [something]" as heaving it left of.
Heaving left is an action applying to one touchable thing and requiring light.  Understand "push [something] to/-- the/-- left" or "pull [something] to/-- the/-- left" as heaving left.
...
...
Instead of doing anything other than examining, spying, entering, heaving, looking under, listening to, climbing, pushing or pulling with the hanging bathtub when the noun is not bustedup:
	say "The tub is way out of your reach."

Edit–I changed ‘heaving left’ and ‘heaving right’ back to its original form, so they would be easier to include in Instead of lists.

OK. It seems that, when heaving is found in that list of action names, the compiler is picking a single action that starts with the same word. (The exact reason that it chooses the one that it does isn’t clear.) The generated I6 for a test scenario looks like:

! Instead of doing anything other than examining , entering , taking , looking under , heaving , listening to , climbing , pushing , pulling or putting with the bathtub:
[ R_799 ;
    if ((((action ~=##PutOn or ##Pull or ##Push or ##Climb or ##Listen or ##A80_heaving_it_left or ##LookUnder or ##Take or ##Enter or ##Examine) &&  (actor==player) && ((noun == I126_bathtub) && (true))))) { ! Runs only when pattern matches
...

Note that the I6 action name (##A80_heaving_it_left) is the only one in the condition. Since the rule is doing anything other than..., the I6 uses the ~= operator, so the rule won’t apply when that specific heaving... action is involved.

Also note that the heaving it left of action requires two parameters, while the rest of those on the list require one parameter. I don’t believe that this is normally allowed, so you may have hit a bug. EDIT: Not a bug. This is allowed.

Something along the pattern of:

Heaving left is tub-prohibited behavior.
Heaving right is tub-prohibited behavior.
Heaving something left of something is tub-prohibited behavior.
Heaving something right of something is tub-prohibited behavior.

Instead of tub-prohibited behavior when the noun is bustedup:
    say "The tub is way out of your reach."

may work better for your purposes. (See WWI 7.15 Kinds of action for more detail.)

1 Like

The above code cleared the compiler, but did not work as intended.

Here is the original Instead of doing anything other than… line of code that did not clear the parser–

Instead of doing anything other than examining, spying, entering, heaving it to, heaving left, heaving right, heaving it left of, heaving it right of, heaving it under, looking under, listening to, climbing, pushing or pulling with the hanging bathtub when the noun is not bustedup:
	say "The tub is way out of your reach."

The ones that did not make sense were the ones that took two things–except for ‘spying’ (from Spying it through)–which is what I don’t get. That action is allowed and works perfectly with the rule. All of the heaving actions were supposed to be allowed but did not return the ‘use the crank’ text(which was intended), instead returned only the ‘way out of your reach’ line. And the problem message did not suggest a solution, it only enumerated the actions that ‘did not make sense’.

Now, when I removed the ‘heaving’ actions that the compiler would not allow, that left only the ‘heaving left’ and ‘heaving right’ actions in the list–they cleared the compiler, and did work. But they take only one thing, the noun.

So why was the ‘spying it through’ action (as spying), which takes two things, allowed, but not the others? Maybe I should find a way to express the heaving actions with other monikers?

Looks like our messages ran into each other.

For actions that take two things, is it possible to write another, separate, Instead of doing anything other than… line for the same object, for actions that take two objects?? Or would this line just replace the first one??

Thank you so much for your help, Otisdog!

I ended up just changing the names to the other heaving actions that took two objects, to ‘heavlefting it of’, ‘heavrighting it of’ and ‘heavundering it of’. Looks quirky, I know, but the player won’t need to know them, and I think they will work a lot like ‘spying it through’ did, of the ‘verb-noun-preposition’ format. Plus the initial word in the names are different. For ‘heaving it to’, I will just use ‘heaving’ in the list; the others will be ‘heavrighting’, ‘heavlefting’ and ‘heavundering’, maybe this will work just as ‘spying (it through)’ did.

Thanks again.

Internally, an action has 4 main parts:

  • actor
  • action name
  • noun
  • second noun

Contrary to what I thought, the doing anything other than... construction specifies a series of action names, irrespective of the number of parameters required. Adding ... with creates a condition on the noun. By default, the actor is the player.

The compiler accepts spying in the list because it can create a condition that will match any action in which the actor is the player, the action name is not spying it through, and the noun is the hanging bathtub (which, in this case, you further specify must be bustedup). Any second noun is allowed.

The other action names on the list (such as examining) only take one parameter (the noun). For these actions, the second noun is internally set to nothing. That’s fine, because the second noun doesn’t matter for this condition.

The core issue is that, in the context of the list of action names, heaving must be evaluated by the compiler as a single action name. You can’t broadly cover all of the action names that start with heaving... in this way. (And your workaround does address this.)

2 Likes

Thanks so much, Otis, for your attention!

That clarifies a lot of things. I’ve had issues with this kind of rule before and changing the first name of the action always resolved it (I had created some two-object actions that had the same (first) name as some of the built-in actions, such as pulling, turning, etc).

You’re welcome. I learned something myself!

1 Like

I feel like this could be a good place to use the action requires a touchable noun phrase.