intfiction.org

The Interactive Fiction Community Forum
It is currently Thu Jun 20, 2013 6:45 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Multi part relationship?
PostPosted: Thu Apr 26, 2012 10:08 am 
Offline

Joined: Thu Jun 02, 2011 3:10 pm
Posts: 68
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!


Top
 Profile Send private message  
 
PostPosted: Thu Apr 26, 2012 10:42 am 
Offline
User avatar

Joined: Sun Nov 22, 2009 12:58 pm
Posts: 403
Location: Malmö, Sweden
I think tables would be your best bet here.


Code:
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.

_________________
~Björn Paulsen


Last edited by Eleas on Thu Apr 26, 2012 10:54 am, edited 1 time in total.

Top
 Profile Send private message  
 
PostPosted: Thu Apr 26, 2012 10:49 am 
Offline

Joined: Thu Jun 02, 2011 3:10 pm
Posts: 68
Ah, darn, I was hoping I could use a relationship(So many fun tools!). But thank you.


Top
 Profile Send private message  
 
PostPosted: Thu Apr 26, 2012 11:02 am 
Offline
User avatar

Joined: Sun Nov 22, 2009 12:58 pm
Posts: 403
Location: Malmö, Sweden
nuku_v wrote:
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.

_________________
~Björn Paulsen


Top
 Profile Send private message  
 
PostPosted: Thu Apr 26, 2012 1:34 pm 
Offline
User avatar

Joined: Sat May 08, 2010 9:25 pm
Posts: 1005
Location: The Seattle Massive
nuku_v wrote:
Ah, darn, I was hoping I could use a relationship(So many fun tools!). But thank you.

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.)


Top
 Profile Send private message  
 
PostPosted: Thu Apr 26, 2012 3:43 pm 
Offline

Joined: Thu May 20, 2010 9:33 pm
Posts: 483
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. :P (Yes, I know Inform does group/nationality-style relationships.)


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: beefparty, fgevaerts and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group