Creating different responses to an action depending on the kind of object

Hi!

I have created a new action: petting
and I want the results to be different if the player pets an animal, a person, or a thing that is neither of those.

Can someone please point me to examples of something like this?

Thank you!

Petting is an action applying to one thing.
Understand "pet [something]" as petting.

Instead of petting an animal: say "This is an animal."
Instead of petting a person: say "This is a person."
Instead of petting something: say "This is a thing."

With new actions it’s more “standard” to use check, carry out, and report rules, but there’s nothing wrong with starting with Instead.

2 Likes

Thank you. This feels very neat and tidy.
I got mired in “if” statements before.

ok. I just realized that down the road, I am going to want different responses from different animals. some animals are afraid of the player. some are friendly. some are hostile.

what would be an elegant way to do this? do i create different types of animals? or attach different properties, like “friendly,” “hostile,” “nervous,” etc. to different animals?

Mood is a kind of value. The moods are friendly, hostile, and ambivalent.
An animal has a mood.

A cat is an ambivalent animal in the Living Room.

Instead of petting an ambivalent animal: ...
1 Like

Draconis’s post shows a way to assign moods to animals.

You could also subgroup by kinds of animals if you want (for instance, if you want more than one cat, and for those cats to have different moods) and finally, you can have reactions just for specific animals that will override that animal’s mood. Here’s an example showing these things:

Summary
The living room is a room.

Petting is an action applying to one thing.
Understand "pet [something]" as petting.

Mood is a kind of value. The moods are friendly, hostile, and ambivalent.
An animal has a mood.

a cat is a kind of animal.

Tom is an ambivalent cat.
Tom is in the living room.

Prancer is a friendly cat.
Prancer is in the living room.

Rex is a friendly cat.
Rex is in the living room.

Instead of petting an ambivalent animal:
	say "[The Noun] is ambivalent.";

Instead of petting a friendly animal:
	say "[The Noun] is real friendly.";

Instead of petting Rex:
	say "Rex has a complex, one-of-a-kind personality.";
	
Test me with "pet tom/pet prancer/pet rex".

-Wade

1 Like

thank you so much!

thank you!