How do I redefine the command SCORE in Inform 7?

How do I redefine the score command in Inform 7? Already “check scoring…” is not working… Here’s my line of rules for scoring command:

if the score is 0, say “You scored [score] out of 250, you have made [turn count] moves, giving you the ranking of Simple Farm-hand.”

I am not using table scoring on purpose… So please do not advise me to use it, although it is duly noted already.

Thank you guys! :smiley:

Never mind! I just figured it out from looking at Graham Nelson’s rpg source to Inform 7. It was a bit simple then I thought:

Carry out requesting the score: if the score is 0, say "You scored [score] out of 250, you have made [turn count] moves, giving you the ranking of Simple Farm-hand." instead.

It’s all good now! :sunglasses:

(On preview, I see you have this, but I’m posting the whole thing for the sake of posterity. Or, well, just because I hate to cancel my reply after I typed it out.)

The name of the action is “requesting the score,” and the rule that governs it is the announce the score rule. So you could:

  1. Include this line:
Understand the command "score" as something new.

and then write your own command (probably overkill if you just want to change the way the score is reported)
2. Write a new rule and then insert it in place of the old rule, like so:

The new announce the score rule substitutes for the announce the score rule.


The new announce the score rule is listed instead of the announce the score rule in the carry out requesting the score rulebook.

Since requesting the score is an action out of world, you can’t use an “Instead” rule–see §12.15.
Ordinarily I would suggest that you might also try to change the output by changing the response texts in the announce the score rule, but it looks to me like the existing announce the score rule is bound up with the Table of Rankings, so that wouldn’t work.

And don’t forget “Use scoring.” Also, from the way you’ve written your rule, it looks like you might want to use a switch statement–scroll to the bottom of §11.8 in Writing with Inform.

Appreciate the reply Matt W! And also the tips to the rules portions of using SCORE. Oh yeah, without a doubt I use “use scoring.” on my source. At first I was trying to get the original status lin layout from the MS-DOS days with Infocom like Zork which was the old “Location Text Score: 0 Moves: 0” one instead of the “Location Text 0/0” which reminded me of TADS 2 btw! I love the save/restore screen provided in TADS 2 but the status line of score and moves kinda sucked. But using these of code:

When play begins: Now the right hand status line is "Score: [score] Moves: [turn count]".

doesn’t do what I expect it, it over-carries the status line and some letters of “Moves:” and the numeric value to a line break… So i opted with a:

When play begins: Now the right hand status line is "SCORE: [score] / 250".

which to me is more appealing then the original “0/0” portion, and harkens back to the times of Comrad64 and other such beauties, and also the Sierra-Online AGI games like King’s Quest… In the words of our dearest friend Mel, it’s good to be the king…

Alright, here’s one that I cannot seem to understand… I how do make it so that no one can score more points at carrying out certain actions? Using

now the action are scored.

does nothing but errors… So I am all thumbs, sorry for n00b questions here guys… :neutral_face:

Never mind, damn I am getting good at this… When thought I was not coming up with a good way to handle this code, I do in the end… What I like about Inform 7 if any way it can read the code and do what you want it to do in alternative then what some other author does with Inform 7 it can… I understand you gave me instructions, Matt W., but it came out the way I anticipated it to be regardless with the score code I had originally, I just had to alter it a bit… I didn’t use the code block you gave me before, due to the complications I had to go through. So as an experienced programmer with a lackluster coding of BASIC, I even put the KISS principle with Inform 7… Now I can make an action do nothing at a certain location when it reaches a certain score, and not go above that score due to the action voided, example:

carry out magick-saying in the Snow-covered Flatland: now the score is 15; if the score < 15, do nothing instead.

It came out the way it should no matter what… Of course after successfully compiling it and testing the 1 room prototype for bugs, it came out perfect, and needless to say victory dancing and trash talking ensued… :stuck_out_tongue:

Here’s how to do the sort of thing that I think you’re trying to do:

"Snow Problem" by Mel Ting.

Use scoring.
The maximum score is 250.

When play begins:
	now the right hand status line is "SCORE: [score] / 250".

Magick-saying is an action applying to nothing.
Understand "xyzzy" as magick-saying.

Report magick-saying (this is the report magick-saying rule):
	say "Nothing happens." (A).

Edge of Forest is a room. "The forest ends here. A [if the Tundra is melted]bare[else]snow-covered[end if] tundra lies to the west."

Tundra is west of Edge of Forest. The printed name is "[if melted]Bare[else]Snowy[end if] Tundra". "[if melted]Bare earth[else]Snow[end if] extends in most directions. The edge of a thin forest is to the east."

The Tundra can be melted or unmelted. The Tundra is unmelted.

The ground is scenery in the Tundra. The description is "[if the Tundra is unmelted]A blanket of snow[else]Rich earth[end if] covers the Tundra."
Understand "blanket" or "snow" as the ground when the Tundra is unmelted.
Understand "rich" or "earth" as the ground when the Tundra is melted.

The acorn is a thing. "A lone acorn rests here, recently uncovered from beneath the snow." 
The description is "Looks like a tough nut to crack." Understand "lone" or "nut" or "tough" as the acorn.

Before attacking or squeezing the acorn when the player does not carry the acorn:
	say "(first taking the acorn)[command clarification break]";
	silently try taking the acorn;
	if the player does not carry the acorn, stop the action.

Instead of attacking or squeezing the acorn, say "You squeeze the acorn with all your might, but to no avail."

Instead of magick-saying in the unmelted Tundra:
	now the Tundra is melted;
	now the acorn is in the Tundra;
	increase the score by 15;
	say "You speak the magick word, and the snow melts!"
Test me with "score / xyzzy / w / x snow / x earth / xyzzy / l / x snow / x earth / xyzzy / x acorn / crack acorn / i / squeeze acorn / score".

Viaviano, my man! :slight_smile: You always have great pearls wisdom, as did Matt W… Both of your expertise in Inform 7 has taught me new lessons to go by in the future. :smiley: