The Cloak of Darkness from firthworks.com/roger/cloak/inform/index.html doesn’t compile on 6L38: Inform7 doesn’t understand the CoD scoring, the end-game messages, or how to change the neatness value of the message.
I’m new to IF (rekindling an interest I had when I was a kid) and haven’t yet figured out how to fix it myself. I’m quite surprised that I7 isn’t backward compatible with work written for older versions.
Would someone be kind enough to share the fixes here?
Scoring isn’t on by default anymore, so we have to add this at the beginning:
Use scoring.
Instead of “end the game” we now say “end the story” (because we’re all about stories rather than games now–this isn’t completely consistent, there are a couple of places where “game” is still used); so we have to change
End the game saying "You have lost"
to
End the story saying "You have lost"
and
End the game in victory
to
End the story finally saying "You have won"
And “change… to…” should be “now… is…” except in a few preset phrases, so we need
if the message is not trampled, now the neatness of the message
is the neatness after the neatness of the message;
And that should do it. Here’s the whole revised code; the tabs got messed up in the copy-paste from the webpage to the IDE but there aren’t any nested tabs where that makes a difference.
[spoiler][code]“Cloak of Darkness”
The story headline is “A basic IF demonstration.”
Use scoring. The maximum score is 2.
[Whatever room we define first becomes the starting room of the game,
in the absence of other instructions:]
Foyer of the Opera House is a room. “You are standing in a spacious hall,
splendidly decorated in red and gold, with glittering chandeliers overhead.
The entrance from the street is to the north, and there are doorways south and west.”
Instead of going north in the Foyer, say “You’ve only just arrived, and besides,
the weather outside seems to be getting worse.”
[We can add more rooms by specifying their relation to the first room.
Unless we say otherwise, the connection will automatically be bidirectional,
so “The Cloakroom is west of the Foyer” will also mean “The Foyer is east of the Cloakroom”:]
The Cloakroom is west of the Foyer.
“The walls of this small room were clearly once lined with hooks, though now only one remains.
The exit is a door to the east.”
In the Cloakroom is a supporter called the small brass hook.
The hook is scenery. Understand “peg” as the hook.
[Inform will automatically understand any words in the object definition
(“small”, “brass”, and “hook”, in this case), but we can add extra synonyms
with this sort of Understand command.]
The description of the hook is “It’s just a small brass hook,
[if something is on the hook]with [a list of things on the hook]
hanging on it[otherwise]screwed to the wall[end if].”
[This description is general enough that, if we were to add other hangable items
to the game, they would automatically be described correctly as well.]
The Bar is south of the Foyer. The printed name of the bar is “Foyer Bar”.
The Bar is dark. “The bar, much rougher than you’d have guessed
after the opulence of the foyer to the north, is completely empty.
There seems to be some sort of message scrawled in the sawdust on the floor.”
The scrawled message is scenery in the Bar. Understand “floor” or “sawdust” as the message.
Neatness is a kind of value. The neatnesses are neat, scuffed, and trampled.
The message has a neatness. The message is neat.
[We could if we wished use a number to indicate how many times
the player has stepped on the message, but Inform also makes it easy
to add descriptive properties of this sort, so that the code remains readable
even when the reader does not know what “the number of the message” might mean.]
Instead of examining the message:
increase score by 1;
say “The message, neatly marked in the sawdust, reads…”;
end the story finally saying “You have won”.
[This second rule takes precedence over the first one whenever the message is trampled.
Inform automatically applies whichever rule is most specific:]
Instead of examining the trampled message:
say “The message has been carelessly trampled, making it difficult to read.
You can just distinguish the words…”;
end the story saying “You have lost”.
[This command advances the state of the message from neat to scuffed
and from scuffed to trampled. We can define any kinds of value we like
and advance or decrease them in this way:]
Instead of doing something other than going in the bar when in darkness:
if the message is not trampled, now the neatness of the message
is the neatness after the neatness of the message;
say “In the dark? You could easily disturb something.”
Instead of going nowhere from the bar when in darkness:
now the message is trampled;
say “Blundering around in the dark isn’t a good idea!”
[This defines an object which is worn at the start of play.
Because we have said the player is wearing the item, Inform infers that it is clothing
and can be taken off and put on again at will.]
The player wears a velvet cloak. The cloak can be hung or unhung.
Understand “dark” or “black” or “satin” as the cloak.
The description of the cloak is “A handsome cloak,
of velvet trimmed with satin, and slightly splattered with raindrops.
Its blackness is so deep that it almost seems to suck light from the room.”
Carry out taking the cloak:
now the bar is dark.
Carry out putting the unhung cloak on something in the cloakroom:
now the cloak is hung;
increase score by 1.
Carry out putting the cloak on something in the cloakroom:
now the bar is lit.
Carry out dropping the cloak in the cloakroom:
now the bar is lit.
Instead of dropping or putting the cloak on when the player is not in the cloakroom:
say “This isn’t the best place to leave a smart cloak lying around.”
When play begins:
say “[paragraph break]Hurrying through the rainswept November night,
you’re glad to see the bright lights of the Opera House.
It’s surprising that there aren’t more people about but, hey,
what do you expect in a cheap demo game…?”
Understand “hang [something preferably held] on [something]” as putting it on.
Test me with “s / n / w / inventory / hang cloak on hook / e / s / read message”.[/code][/spoiler]
Also there may be another 6L version of Cloak floating around somewhere–from the homepage that describes Inform 7 as “nearing completion” I’d guess that those pages aren’t thoroughly maintained.
Welcome to the strange and intermittently moth-eaten world of IF! We have some wonderful authoring tools (Inform 7, TADS 3 (with or without adv3Lite), Undum (with a side order of Vorple) for the bold, Twine for the timid … and even Inform 6, which is still very viable), but because it’s an all-volunteer community, the software is not always kept as neat and tidy as we might prefer. For that matter, expensive commercial software isn’t always neat and tidy either!
Thanks Matt. I had a bit of a hunt around and couldn’t find an up-to-date version. It is unfortunate that the I7 compiler deprecates constructs without providing useful error messages for bringing deprecated code up to date. e.g.
“I see you’re expecting scoring to be on. Since version XYZ that scoring is no longer on by default. Instead, you can explicitly turn on scoring by …”
Thanks for the welcome, Jim. I’m quite used to software with ragged edges; I won’t be scared away that easily. Actually, I tend to be a bit more interested in the mechanics than the story - I’m quite happy writing a bit of code to do something. I prefer parser-based IF, perhaps because it is more technical and gamey, and less storyish.
We probably agree about that … although I’ve been seeing a lot of posts lately from authors who want to run stats on their characters for health, stamina, charisma, and the whole D&D scenario. I’m not that gamey.
I agree that it would have been nice if the Inform compiler would provide sensible error messages in response to deprecated code constructions. But there may be technical reasons why that would be difficult. If the compiler fails to understand a given construction, should it then loop back through the not-understood sentence looking for deprecated elements? That might be a recipe for confusion, it would certainly have meant a lot of extra work for Graham Nelson (who I’m sure is working hard enough as it is!), and the benefits to authors would not necessarily be significant.
Normally Inform does give you enough warning and instructions for how to convert depreciated things. The issue is that people normally don’t turn on the “use no deprecated phrases” option, so they don’t get the warnings while the phrases still work.
Specific error messages like that would be nice, and perhaps they could be added, but probably not entirely consistently. Remember that extension authors can depreciate their own phrases too, but there’s no way to specify any alternative like that. You’re meant to look at the instructions/change log.
It was in 6G60 and that generation of versions (I think), when some big changes were being planned for the next version but not implemented yet. In particular, it was known that procedural rules were going to get eliminated in the next version and there was usually a pretty simple workaround for any procedural rule you might want,* so if you turned on “Use no deprecated phrases” that would give you a warning that you had to rewrite things a bit for the next version.
But if you don’t turn on “Use no deprecated phrases,” or you take a piece of code from before 6G and try to update it straight into 6L, that won’t really work.
*By the way this is a reason why Inform 7 isn’t backward-compatible; the procedural rules generated a lot of overhead and needed to be eliminated, because they would have to be checked before any rule ran.
Are there any allowable-but-deprecated features in 6L38?
Even with “use no deprecated features” on, “change… to…” gives a “Maybe you forgot to define that phrase” error. (Whereas in Playfic it gives “Ordinarily I’d let you do this, but it’s deprecated.”) Unless there are other deprecated features, it doesn’t seem as though that would help you update your code if you skipped a version.
The only phrase I see marked “deprecated” in the 6L38 Standard Rules is “remove (something) from play”. (Rephrase as “now (something) is off-stage.”)
That would require a “use obsolete features anyway” option, which doesn’t exist.
If you want to do a deprecation check, you need to download the old (6G60) compiler, add “use no deprecated features”, compile the code, update it, and then shift it over to 6L38.
Right, that’s why it’s basically “Inform gives you warning if you turn on use no deprecated phrases and you happen to try the old code in the version before it gets eliminated.” (I agree that the general solution is to point people toward the changelog rather than try to catch it in the compiler.)