Secret scoring system with multiple separate scores

I think the idea is to look up each part of the call-out separately? So the “tiephrase” of Murders Committed would be “kill someone” and the tiephrase of Hours Volunteered would be “volunteer” and then you can just stick “or” in the middle?

But that breaks down if you want a truly custom phrase for each pair of scores.

2 Likes

Yes, I want a custom phrase for each pair.

I have set myself the task of a game with a lot of choices, so it’s part parser, part choice-within-a-parser. And tracking all that to get different endings according to how high the high score is and which thing gets the highest score.

It’s hard. I feel a kinship with choice authors now that I see they do 5 hours of work for all the choices in 30 seconds of gameplay, and the player will never see all that work.

2 Likes

Looks like the syntax issue is that you need to say “the scorename in row 1 of the table of ethicsscores”, not “scorename of row 1…” – gotta love Inform’s flexible natural language approach! But yeah, as to my suggestion, Josh had it right – it may not match what you’d like to do, but here’s a little example just in case:

Lobby is a room. 

ScoreName is a kind of value.  The ScoreNames are Murders Committed, Hours Volunteered, Kittens Cuddled, and Newspapers Perused.

Instead of jumping:
	Sort the table of EthicsScores in reverse score order;
	If the score in row 1 of Table of EthicsScores is the score in row 2 of Table of EthicsScores:
		If the score in row 3 of Table of EthicsScores is the score in row 2 of Table of EthicsScores:
			Say "[tiephrase in row 1 of Table of EthicsScores in sentence case], [tiephrase in row 2 of Table of EthicsScores], or [tiephrase in row 3 of Table of EthicsScores]?";
		Otherwise:
			Say "[tiephrase in row 1 of Table of EthicsScores in sentence case] or [tiephrase in row 2 of Table of EthicsScores]?"	

Table of EthicsScores
ScoreName	score	tiephrase	
Murders Committed	9	"kill someone"
Hours Volunteered	10	"volunteer more"
Kittens Cuddled	10	"hug a kitty"
Newspapers Perused	10	"read another issue"

(I may have forgotten the other scores other than the murders/volunteering and made stuff up instead).

1 Like

I did try that because it was so frustrating to learn that the first time that I actually remembered it. No dice. I think it’s objecting to the “corresponds” language. All the examples in the docs use “corresponding to blah blah,” but I fiddled with variations on that for a while and it got really complicated and none of it was right, so I figured there was another finicky syntax thing about “corresponding” that I’d better ask about.

As to a table: these are going to be fairly long endgame text dumps, and it’s possible that I’ll add a little more gameplay and I’ll need to put conditions on the player for each outcome here. And that makes a table start to look LOOOOONG and complex and force me to do ugly workarounds to add conditions. The table example is edifying, but I am scared of it.

1 Like

Oh sorry, yeah, it’s “is”, not “corresponds” – that might just be for topics?

Not to keep harping on the table thing, but you could also use to say phrases to write as elaborate a custom response as you want (capitalization is messed up here since as you know, capitalization is a giant pain):

Table of EthicsScores
ScoreName	score	tiephrase	
Murders Committed	10	"[murderstie]"
Hours Volunteered	10	"volunteer more"
Kittens Cuddled	10	"hug a kitty"
Newspapers Perused	9	"read another issue"

To say murderstie:
	If the player is caught, say "It might be hard to do this while you're locked up, but ";
	If the player encloses the bloody knife, say "Luckily you have this knife to hand in case you want to ";
	Say "kill more victims".
1 Like

OK, but I’m STILL not sure how to get a [murderstie] answer for a tie of murders committed with Hours Volunteered, and for a tie of Murders Committed with Kittens Cuddled, and for each possible combination. In the “To say murderstie” code I’d still have to link it to each other ScoreName individually, wouldn’t I?

1 Like

Oh, I see this is how I’d link them. Yikes. Well, if no one else chimes in with the syntax for the system I already set up, I’ll give this a whirl, but it looks headachy.
Not that I am not thankful for the effort.

1 Like

Yeah, if the text for each combination is going to be mostly unique (like, murder + volunteer is “Your humanitarian efforts are concealing your bloodthirstiness, but now it’s time decide what kind of spree you’ll go out on” while murder + puppies adopted is “All the dogs running around the place sure do help you conceal the evidence; but tonight are you headed to the pound or the murder dungeon?”), rather than having repeated elements based on each score (where the “murder” part of the prompt wouldn’t change much based on what score it’s tied with), there’s probably no way around the case-by-case hardcoding. I just tend to grimace because I’ve done stuff like that and then wished I could easily make tweaks later, but instead have to copy and paste the same/similar text a dozen times and hope I don’t make a mistake and wind up with inconsistencies…

EDIT: oops, cross-posted! If you want to stick with your initial approach, all you need to do is swap out:

if the scorename of row 1 of the Table of EthicsScores corresponds to a scorename of Murders Committed :

For:

if the scorename in row 1 of the Table of EthicsScores is Murders Committed:

(And so on for the other conditionals)

1 Like

This is real code (will work in 10.1 but not 9.3/6M62):

lab is a room.

scoreval is a kind of value. Scorevals are
Number of Murders Committed, Puppies Adopted, Old Ladies Mugged, Volunteer Hours, Butterflies Smashed, Charitable Dollars Donated.

The player has a relation of a scoreval to a number called the scoreboard. 

To decide what number is the player's (sc - scoreval):
  decide on the number to which sc relates by the scoreboard of the player.

to set the player's (sc - scoreval) to (n - number):
  now the scoreboard of the player relates sc to n;


first when play begins:
  repeat with x running through the scorevals begin;
    set the player's x to 0;
  end repeat;

to test for ties:
let finish be the last value of scoreval;
let start be the first value of scoreval;
repeat with x running from start to finish begin;
  let y be the scoreval after x;
  if y is start, break;
  repeat with z running from y to finish begin;
[    if the player's x is the player's z, say "tied.";]
    [ we know x is always < z so we don't have to think about order ]
    [ look up the row in the table of tied scores with scoreval1 == x and 
       scoreval2 == z, get the tie-text ]
  end repeat;
end repeat;

This is bogus code:

Table of Tied Scores
scoreval1 (scoreval) scoreval2 (scoreval) tie-text (text) 
Number of Murders Committed , Puppies Adopted
Number of Murders Committed , Old Ladies Mugged
Number of Murders Committed , Volunteer Hours
Number of Murders Committed , Butterflies Smashed
Number of Murders Committed , Charitable Dollars Donated
Puppies Adopted , Old Ladies Mugged
Puppies Adopted , Volunteer Hours
Puppies Adopted , Butterflies Smashed
Puppies Adopted , Charitable Dollars Donated
Old Ladies Mugged , Volunteer Hours
Old Ladies Mugged , Butterflies Smashed
Old Ladies Mugged , Charitable Dollars Donated
Volunteer Hours , Butterflies Smashed
Volunteer Hours , Charitable Dollars Donated
Butterflies Smashed , Charitable Dollars Donated

But make a real table like that and you’ve got a straightforward way to test for ties and look up a text based on them. Does not extend to more than two values, of course.

2 Likes

WHEW. Thanks. I futzed with so many permutations of this and it turns out to be so simple. Thanks-- that’s what I was looking for.

Wow. That’s amazing, and beyond my pay grade. I’ve got my ugly system working, but I’ll pick through this and see if I can understand it. Also, I know I said a year ago at least that I would get v10, but I haven’t, because a.) I keep picking up bits of games written in the old version, and b.) Change is hard.

3 Likes