Creating a new verb: meowing

I’m trying to create a new verb (to meow at) and I just do not understand the process for creating it. Based on similar code examples I’ve seen, the following seems like it should do what I need it to:

Meowing is an action applying to one thing.
Understand "meow at [something]" as meowing.

Instead of meowing at the cat:
	say "He meows back at you.".

Bedroom is a room. "You're in the bedroom." In the Bedroom is a cat.

However I get the following error message:

You wrote ‘Instead of meowing at the cat’, which seems to introduce a rule taking effect only if the action is ‘meowing at the cat’. But that did not make sense as a description of an action. I am unable to place this rule into any rulebook.

3 Likes

It looks like you called your verb “meowing”, so you need to say ‘instead of meowing the cat’.

On the other hand, you could change the name of your action to ‘meowing at’. Like:

Meowing at is an action applying to one thing.
Understand "meow at [something]" as meowing at.

Either way, all that matters is that they match (either use ‘at’ all three times or never at all).

It would be a good idea to also include a ‘carry out meowing at something’ rule for players that type ‘meow at me’ or ‘meow at rock’.

Something like:

Carry out meowing at something:
	say "You look a little silly meowing at [the noun]..".

This wouldn’t interfere with the rule you already have, since an ‘instead’ rule is more powerful than a ‘carry out rule’.

7 Likes

Thank you, that fixed it! So when you create a new action you have to use any prepositions everywhere (which makes sense).

I have a question about the second part of your reply: how do you know when to use instead vs Carry out? My understanding is that instead is used for is defining how to carry out some sort of action (which seems counterintuitive). Why wouldn’t I simply use a carry out for both? Also, is there any benefit in having two rules rather than having an instead or carry out rule with nested if statements?

3 Likes

Carry out should generally be used for carrying out actions - instead should be used when the action the player types shouldn’t actually happen and rather something else should. It’s very easy for new authors to fall into the habit of using instead rules for everything, though, since it doesn’t require you to dig into the complicated action-processing system. But it’s good to resist that temptation if you can - here’s a good thread on why:

Oh, and as to the benefit of multiple rules vs one with nested if statements - either can work, depending on your stylistic preference. It can often be a little easier to see how things interlock with one rule, but it eventually can get unwieldy, and the ability to manually shift what order rules fire in can sometimes be useful. So sorry, that’s not very helpful!

3 Likes

Oh, and as to the benefit of multiple rules vs one with nested if statements - either can work, depending on your stylistic preference

And in the process of looking up how if statements work, I’ve also now discovered this construction:

To comment upon (whatever - a thing):
    if whatever is transparent, say "I see right through this!";
    if whatever is an open door:
        say "Oh look, an open door!";
        if whatever is openable, say "But you could always shut it."

(That’s from the example in 11.7 of the manual). So… is this another way of creating a new action? where does the “To [verb]” construction fit into the language?

2 Likes

That’s a phrase, which is the subject of all of chapter 11.

Phrases are not actions. In traditional programming languages, we’d say “function” or “routine”.

4 Likes
  • Before: these rules run before anything gets checked. The objects involved in the action have to exist. That’s it. This is the best place to cut off the action and turn it into something else entirely: “oh, you don’t want to open the desk, you want to open the drawer”.
  • Instead: these rules run after certain basic checks, like having enough light, or not being locked in a closet. This is the best place to write special behavior for your story.
  • Check: these rules make sure the action is feasible, and you’re not trying to eat rocks or pick up grand pianos. You generally only need these when you’re making new actions.
  • Carry out: these rules actually perform the action. You generally only need these when you’re making new actions.
  • After: these rules run after the action finishes, to deal with side effects and special descriptions for special circumstances. This is the best place to change how an action is described in one specific case, without changing how it’s actually performed.
  • Report: these rules run at the very end, to describe what happened. You generally only need these when you’re making new actions.

In other words, Check, Carry Out, and Report are for the standard/expected behavior of the action, and Before, Instead, and After are for the exceptional cases that make your game your own. If you make a new action, you’ll want to write some Check/Carry Out/Report rules. If you’re using the standard actions, you’ll generally want Before/Instead/After.

5 Likes

If you’re just looking to respond to a unique verb, it can be easy as:

Report meowing at:
    say "You meow at [the noun]."

Report rules generally are used for a default general response, but you can write more specific rules which will always take precedence.

Report meowing at the Evil Gardener:
    say "You hiss at the Gardener, knowing he somehow controls all those random water sprays.";
    stop the action.

Report rules continue the action by default, so you don’t also want to see the generic message which also applies - the more specific rule that mentions the Gardener will run first. You could always use an After rule which runs before report and stops the action by default.

After meowing at Aunt Tilly:
    say "You meow sweetly and accept a gentle ear scratch from the comfy-lapped matriarch.";

Adding all these rules does not preclude separate rules for effects which is what Carry Out is for:

Carry out meowing at:
    increase catsense by 10.

Carry out meowing at Aunt Tilly:
    increase fluffiness by 5.

Carry out meowing at the Evil Gardener:
    increase clawitude by 15.

Carry out meowing at the front door:
    if front door is locked:
        if Fred is not busy:
            now front door is unlocked;
            now front door is open;
            say "Fred is tired of hearing you whine and cracks the front door so you can enter the house, even though both of you know you'll be wanting back out in roughly eight and a half minutes.";

After meowing at the front door when the front door is open:
    say "The door is open; you can go in."

After meowing at the front door when the front door is locked;
    say "There is no response to your pathetic mewling. That human with the tricky opposable thumbs is somehow not paying attention to you."

All these rules can stack and work separately since they only fire if the command specifically matches.

A “to [something]” construction like Zarf explained creates a phrase for author use, but not an action the player can type. Phrases are routines that can be triggered from player commands:

To go ham on (victim - a person):
     say "You transform into a cloud of flying fur and claws, showing [victim] some feline justice.";
     decrease HP of victim by 2;
     say "'Yeowtch!' cries [victim]."

After meowing at the Evil Gardener when Evil Gardener carries the rake:
    go ham on the Evil Gardener.
4 Likes

…I had been operating under the assumption that all new actions had to end in -ing, so I’ve been writing things like (to use this example) “meowating” :joy:. Good to know I can use regular English!

4 Likes

Nope! There has to be an -ing somewhere in there, but it doesn’t have to be on the last word.

6 Likes

Now that I know that “meowing at” was the complete action, it dawned on me that since it was different to “meowing” in general… I could also now have a “meowing” verb that applies to nothing—so, if you just wanted to meow but not at something, you could create that action as well. They’re literally different verbs, but because of how I had been thinking, I didn’t realize that “at” was part of the name of the action. I’m still getting used to the idea that objects and variables can have spaces in their names, and in fact that has been a major hurdle in trying to intuit how things work in the language. It’s a beautiful language but often I will see code examples where I think, “how did they know to do it that way?” /rant

6 Likes

Yep, it’s possible to have different actions with the same verb, as long as they use different prepositions—the Standard Rules distinguish “pushing something” from “pushing something to a direction”. I don’t recommend it, because it can make things difficult to read in some cases, so I would call them “meowing at” and “meowing generally” or something like that, but that’s just my taste.

2 Likes

And if writing for an audience that might include users of British English, you could also include:

Understand "miaow at [something]" as meowing at.
Understand "miaow" as meowing.

:slightly_smiling_face:

4 Likes

Yes, and be sure to make the cat pattable as well as pettable for our transatlantic friends!

4 Likes

We can both pet and pat our pets :slight_smile:

4 Likes
Understand the command "miaow" as "meow".
6 Likes
meowing at is an action applying to one thing.
Understand "miaow at [something]" and "meow at [something]" and "mee-yow at [something]" as meowing at.

meowing is an action applying to nothing.
Understand "miaow" and "meow" and "mee-yow" and "le meow" and "le-meow" as meowing.
3 Likes