Multi part relationship?

Say I had a type of object, called a commodity.

And I want different people to trade different things when given a commodity.

For full example, say we have iron, steel, copper, cheetos, and pizza.

Bob will give you pizza if you give him iron.

Sue will give you copper if you give her pizza, she will also give you cheetos if you give her steel.

Joe will give you iron for copper, and steel for pizza.

How do I describe these relations? Is relation the right word for this? Thanks!

I think tables would be your best bet here.

The block giving rule is not listed in any rulebook.

A commodity is a kind of thing.
iron, steel, copper, cheetos, and pizza are commodities.

The giving it to action has an object called the object received. 

Carry out giving something to someone:
	repeat through Table of Exchanged Goods:
		if the noun is your gift entry and the second noun is interlocutor entry:
			now the player is holding their gift entry;
			now the interlocutor entry is holding your gift entry;
			now the object received is their gift entry.

Report giving it to:
	say "[The second noun] gives you [object received] in return!"

Table of Exchanged Goods
interlocutor		your gift		their gift
Bob				iron			pizza
Sue				pizza		copper
Sue				steel		cheetos
Joe				copper		iron
Joe				pizza		steel

Bob and Joe are men. Sue is a woman.
Home is a room. Bob, Joe and Sue are in Home. The player holds iron.

EDIT: Bear in mind that (purely from laziness on my part) I cut some corners on the example. For this to work well I’d at least add a rule to block giving if no suitable pair of interlocutor - gift was found in the table. I’d probably also block the action if the interlocutor no longer held their gift.

Ah, darn, I was hoping I could use a relationship(So many fun tools!). But thank you.

No problem. Come to think of it though, there was some talk about leveraging tables in order to create phrase structures to mimic three-way relations (for instance when you have relations on the form of person - value - person, such as “John really likes Eric”) a while back. In other words, you can use relations and tables in conjunction for some nifty effects.

There’s been some call for three-way relations, and the developers are considering it, but I don’t think it’s a priority. (Even two-way relations can have serious performance issues if used too heavily.)

The problem (a perk?) with reading these forums in succession with the various other internet things I read is that I very much misinterpreted this conversation for about half a second. Perhaps Inform should just implement an “it’s complicated” relationship and be done with it. :stuck_out_tongue: (Yes, I know Inform does group/nationality-style relationships.)