End game with "You have found x/6 endings possible."

How do you do that?

And also, how do I use a variable with a stored value?

There’s an extension available for saving information about previous endings: inform7.com/extensions/Emily%20S … index.html

I’m not sure what you’re asking. Chapter 8.1 of the manual covers variables, is there something specific you’re having trouble with?

Yes. Ok, so in my game, the player chooses whether to TAUNT, BARGAIN WITH, REASON WITH, or BLACKMAIL an NPC to get them to do what they want. Each time the player performs one of those actions, a variable is incremented by one. At the end of the game, whichever variable is the greatest will determine which ending the player gets.

Here’s part of the code:
Instead of getting:
sort the Table of Win in reverse order;
if the first row of the Table of Win>3 begin;
if the first row is IndignantCount;
say "‘If you’re so strong, why can’t you get the ball?’ ";
choose a random row in the Table of Indignant Events;
say “[events entry][paragraph break]”;
say “[bold type]FAIL[roman type][paragraph break]Next time, don’t tease Tommy so much or try to butter him up.”;
end the story finally;
else if the first tow is ForcedCount;
say "Tommy looks at you, look at the fence, looks back at you. ‘Finnneee…’. Tommy climbs the fence. ";
choose a random row in the Table of Forced Events;
say “[events entry][paragraph break]”;
say “[bold type]SUCCESS[roman type][paragraph break]But this isn’t the best ending. Try something other than forcing him to go.”;
end the story finally;
else if the first row is TerrifiedCount;
say “I think I broke Tommy. He just sits there, looking at me.”;
choose a random row in the Table of Terrified Events;
say “[event entry][paragraph break]”;
say “[bold type]FAIL[roman type][paragraph break]How did you expect to get anywhere by making the kid too afraid to go? Try being nicer next time.”;
end the story finally;
else if the first row is RighteousCount;
say “Tommy agrees. ‘I’ll go get the ball.’ He marches up to the fence, looking like a warrior.”;
choose a random row in the Table of Righteous Events;
say “[event entry][paragraph break]”;
say “[bold type]BEST ENDING[roman type][paragraph break]Congratulations! You convinced Tommy, and did it in the best way possible.”;
end the story finally;
otherwise;
say “[bold type]FAIL[roman type][paragraph break]Tommy feels confused, and, not knowing what to do, just sits and stares. [paragraph break]Have a more focused attack next time.”;
end the story finally;
end if.

Table of Win
counter
RighteousCount
IntimidateCount
TerrifiedCount
ForceCount

However, Inform gives me this error when I do this:
Problem. In the table Win, the entry ‘RighteousCount’ is the name of a value which varies, not a constant, and therefore can’t be stored as a table entry.

Help, please. :confused:

Well, the error suggests that you can’t use the name of a variable as an entry in a table. In this case, what I think I’d do (totally untested) is define the four types of ending as a kind of value (“Attitude is a kind of value. The attitudes are indignant, righteous, terrified, and forced.”) Then I’d use a two-column table, where the first column is the attitudes and the second column is the attitude count – starting at zero, and getting increased whenever you’re currently increasing righteouscount or whatever. Then you can sort the Table of Win in reverse count order and read off the attitude that is at the top. As I said, though, I haven’t tried this.

By the way, to make your code more readable, you can use code tags – type around your code (except with [] instead of <>) or just use the “code” formatting button. This lets you copy and paste your code in and preserve the tabs – though it looks like you’re using begin/endifs instead of tabbed code blocks anyway. Still, it’ll set the code off. (Also, you have “tow” one place where you should have “row.”)