So one thing I didn’t quite realize was that you needed the listeners’ quips to agree with each other. That makes it a little more complicated; one thing you can do is have one loop inside another.
[code]Lecture Hall is a room. The professor is a woman in Lecture Hall.
Statler and Waldorf are men in Lecture Hall.
Pintel, Ragetti, Tahei, and Matsahichi are men.
Definition: A person is a listener if it is not the player and it is not the professor.
Origin is a kind of value. The origins are null, The Muppet Show, The Hidden Fortress, and Pirates of the Caribbean.
A person has an origin.
The origin of Statler is the Muppet Show. The origin of Waldorf is the Muppet Show. The origin of Tahei is The Hidden Fortress. The origin of Matsahichi is The Hidden Fortress. The origin of Pintel is Pirates of the Caribbean. The origin of Ragetti is Pirates of the Caribbean.
Every turn:
repeat with first subject running through listener people in the location:
repeat with second subject running through listener people in the location:
if second subject is not first subject and the origin of second subject is the origin of first subject and the origin of first subject is not null:
say “[First subject] and [second subject] come from the same work!”
Every turn:
let departee be a random listener in Lecture Hall;
let enteree be a random off-stage listener;
say “[Departee] excuses [themselves] and [Enteree] enters.”;
now departee is nowhere;
now enteree is in Lecture Hall.[/code]
Another thing I did there was define “listener” as someone who is not the professor and not the player, which is a way of getting the syntax to include the non-player person. A problem that this has is that it produces every match twice (once for Pintel as the first subject and Ragetti as the second, once the other way around); you could solve that by having the outer loop set a flag on each person that determines whether they’ve already been the first subject, like this:
[code]A person can be already checked.
Every turn:
now every person is not already checked;
repeat with first subject running through listener people in the location:
now first subject is already checked;
repeat with second subject running through listener people who are not already checked in the location:
if the origin of second subject is the origin of first subject and the origin of first subject is not null:
say “[First subject] and [second subject] come from the same work!”
[/code]
All this can probably be made simpler if it’s guaranteed that there will always be exactly two listeners in a room at once.
The relationship points thing is also tricky. You can’t actually give points to a relation–you can set a relation between Pintel and Rigetti, but you can’t define a three-way relation between Pintel, Rigetti, and a number. I think the easiest way to keep track of relationship strengths between characters will actually be to set up a table with columns for the people and a column for the relationship, kind of like this:
Table of Relationships
first subject second subject relationship points
Pintel Rigetti 0
(etc.; if you’re actually doing this it’s probably best to write a routine to automatically fill out the table’s initial values rather than write it all out by hand). Then it might be easier to have your loops go through the table instead of first finding the two people whose quips agree and then finding the row in the Table of Relationships where you have to change their relationship points.
On that last part, I have a bit of a personal addiction to putting tables in Inform code, so you might want to take it with a grain of salt when I advise that.