Ending a game with score maximum

Hey ya’ll. So I’ve read through chapter 9.4 “When Play Ends” but I’m still a little confused (what else is new). I have a game where, when certain goals are reached, “increase the score by 1”. I want the game to end when the player reaches 3 points and print some text that I’ll whip up later. I’m just not sure how to accomplish this. I’ve got the “The maximum score is 3.” line, and I have the "end the story finally saying “You win” bit, but how do I put it all together?

Thanks in advance! You guys and girls have been really helpful as I’ve been making my game. :smiley:

Every turn when the score is the maximum score: end the story finally.

Just that easy huh? Figures! :laughing: Thanks so much!

I’d suggest using this.

Every turn when the score is at least the maximum score: end the story finally.

This way if the score accidentally goes over the maximum, the game still ends anyway.

Hope this helps.

Surely by setting a maximum score it is impossible for the score to exceed it?

I suppose that both “score” and “maximum score” are just numbers that vary, so there is no reason the former couldn’t be higher than the latter. Inform generally doesn’t try to be overly smart. (Which is good, for you might want to make a game where your score goes over the maximum, and then – for instance – goes down again as you have to sacrifice all your treasures in order to escape the dungeon alive.)

Yeah, maximum score is just a number; Inform doesn’t extrapolate it from the code or anything. (I think some system - TADS? used to have a maximum score that was set to 100 by default, so that there were tons of games where the author didn’t bother to change it and your score was always 0 out of a possible 100. Gosh, that was annoying.)

Agreed, but a bit of bug-checking never hurt.

I tend to give in to the temptation of throwing out scores early & that causes a lot of rejiggering.

And it’s not clear to me why you would need to check for a maximum score in most standard games–usually there is some winning action, or final thing to do, to win. Or if there are branches, score may not be fully appropriate.

However, it’s always good to see someone coming up with a new way to use score.

Theoretically that should be the case. However, it relies on the author being careful when awarding points.

It’s for that very reason that the phrase “award X points” has been depreciated.

However, since it is only a number variable, there isn’t many interesting things you can do with it.

Your entire hard drive is just a number variable! But there are many interesting things you can do with it. :slight_smile:

Using the score to gauge when to end the game isn’t totally unprecedented; I did something similar for Delicious Breakfast. (There, though, the end is triggered by a scene.) It’s mostly useful for games where a player has several tasks to do in no particular order.

Really? I can only think of two, reading and writing! :wink:

Boooooo! :slight_smile:

But seriously, back to the score discussion, having a score–and checking the maximum–can help weed out bugs. It’s potentially one more layer of testing. For instance, having this in place helped catch a few bugs when I tried to determine maximum/minimum possible score to solve a game of mine.