Invent a verb

I hope I’m not wearing out my welcome here. Maybe I can repay the community by releasing a decent game (decent for a newbie, that is) :stuck_out_tongue:

Here’s something that has come up again and again. Suppose I want to invent a verb, and invent something new that happens when the player uses that verb, not just map it to an existing verb. For example I figured out “Understand ‘pick [something]’ as taking” when I wanted the player to be able to pick flowers. But what if I want to do something totally new?

Like,

Instead of dig: If player is in the forest, say "You dig a hole and find a beetle" move beetle to Forest. end if

Or, in the case of transitive verbs:

Instead of chasing the bird: Say "You run after the bird and catch it", move bird to player.

This is a skill I could use again and again.

Thanks to everyone for all their help here. I’m having a great time and I predict this hobby will be more than a short term one for me!

Apparently I need to practice a little patience.

I just came across this in the documentation, and though I haven’t yet applied it to the things I want to do, it looks like it will work for me.

Putting it here for anyone else who might have searched for it:

Universal opening is an action applying to nothing. Understand "open sesame" as universal opening. Carry out universal opening: now all doors are open. Report universal opening: say "Open Sesame!"

(Well, you beat me to the post, but here it is anyway.)
Hi! Don’t worry about wearing out your welcome. :slight_smile: Check out the docs, starting with ch 12.7 “New Actions” for the complete answer to your question. In a nutshell, though, you create an action like:[code]Digging is an action applying to nothing.

Chasing is an action applying to one thing.

Hitting it with is an action applying to one thing and one carried thing.[/code]Notice the definition itself tells you if the verb is transitive or not, or if it requires an indirect as well as a direct object. It also sometimes mentions other requirements (carried, requiring light, etc.). Then you can add your “understand” grammar, just like you do with existing verbs. Finally, add the check, carry out and report rules. You can use “instead” rules at first to experiment, but personally, I think over - reliance on them leads to messy code later. Ideally, they’re supposed to be used to override behavior (hence the name “instead”), not for coding entire new actions. Hope that helps.

Actually I was only able to get a transitive verb to work this way:

[code]Chasing[something] is an action applying to one visible thing.
Understand “chase[something]” as chasing.

Instead of chasing the bird:
say “you chase the bird”;

Instead of chasing an animal:
say “you chase an animal”;

Instead of chasing[something]:
say “you cannot chase that”.[/code]

Without [something], during game play I typed in “chase bird” and got “I only understood you as far as chasing” rather than the intended message.

Chasing[something] is an action applying to one visible thing. The [something] above does nothing. Anything in brackets outside of quoted material is a comment and thus ignored. It would be the same if you put: Chasing[put any kind of gibberish you want here and it would still work] is an action applying to one visible thing. The place you need “[something]” is here: Understand "chase[something]" as chasing. Which I didn’t mention since you seemed to get the whole grammar thing from the earlier post. :slight_smile:

It sounds like you’re doing fine, but you may also find it useful to look at the Recipe Book sections on adding a new command. Online, that section starts here:

inform-fiction.org/I7/Rdoc27.html

…but it also is in your built-in documentation.

Well Mike, obviously I don’t know as much as you think I do :slight_smile: Thanks for the clarification.

Emshort, thanks for the great resource!