7.4. Barter and Exchange

| Chapter 7: Other Characters |

| 7.4. Barter and Exchange

By default, Inform characters are a bit grudging about giving and sharing objects: they react with disinterest when they're shown things and refuse everything they're offered.

If we'd like to change this, we can simply remove the default "block giving" rule, as in

> The block giving rule is not listed in the check giving it to rules.

If we do this, giving items to characters will have the result of moving our possessions to the other person's inventory. Of course, without more customization, the player may not ever be able to persuade the other character to return his possessions. Bribery demonstrates a scenario in which a character will accept gifts if they are interesting to him, and respond with a changed attitude to the player.

Barter Barter expands further on this by allowing other characters to trade things with one another.

See Modifying Existing Commands for ways to allow the player to give or show things that he isn't currently holding

See Actions on Multiple Objects for an implementation of giving that allows the player to offer multiple objects at once, where their combined value determines whether they are accepted

See Money for ways to keep track of cash flow, physical money objects, and price negotiations

378
| Example Bribery A GIVE command that gets rid of Inform's default refusal message in favor of something a bit more sophisticated. |
WI

207
| Example Barter Barter Allowing characters other than the player to give objects to one another, accounting for the possibility that some items may not be desired by the intended recipients. |
WI

By default, if we make no modifications, telling one player to give something to another will fail, even if persuasion succeeds. This is because the default behavior of the GIVE command is interrupted by the "block giving rule" -- since in many cases we do not want people to exchange objects freely. However, suppose that we do want characters to be able to exchange articles freely: we allow persuasion to succeed and turn off the "block giving rule". "Barter Barter" The block giving rule is not listed in the check giving it to rules. A persuasion rule for asking people to try giving: persuasion succeeds. The Trading Post is a room. Meriwether Lewis is a man in the Trading Post. He carries a fluffy handmade quilt and a bag of beans. The beans are edible. William Clark is a man in the Trading Post. He carries leather slippers, a journal, and a loaf of bread. The bread is edible. The slippers are wearable. Instead of examining someone: say "[The noun] is carrying [the list of things carried by the noun]." And now we might want to implement a way to keep track of whether the recipient character wants what's being offered: Check someone trying giving something to someone (this is the sneering refusal rule): if the second noun dislikes the noun, stop the action. Unsuccessful attempt by someone trying doing something: if the reason the action failed is the sneering refusal rule, say "'Would you care for [the noun]?' [the person asked] asks solicitously of [the second noun]. But [the second noun] refuses [the noun] disdainfully."; otherwise say "[The person asked] just appears bewildered by this improbable instruction." Distaste relates one person to various things. The verb to dislike (he dislikes, they dislike, he disliked, it is disliked, he is disliking) implies the distaste relation. Clark dislikes the beans. Lewis dislikes the bread. Since we've defined this as a relation, we could change what the characters like and dislike during the course of the game, freely; for instance, characters might grow hungry and suddenly like all the edible articles. Test me with "x lewis / x clark / clark, give the slippers to lewis / clark, give the bread to lewis".

Previous | Contents | Next