Hello! I am pleased to announce that I have prepared a new Parchment template for Inform 7. This template is for both Z-Machine and Glulx. Get it here and then unzip into your Inform/Templates/ folder (or your story’s .Materials/Templates/ folder).
This code will be the basis of online play support for Z-Machine and Glulx games in the upcoming IF Comp. There are likely to be bugs so let me know what issues you come across. It will also, hopefully very soon, be the basis of a brand new version of Parchment for iplayif.com, as well as bringing the stylehints and formatting features to Lectrote.
PS: the last major part of the Glk spec that GlkOte is missing is sound support. If anyone would like a programming challenge, that’s something that would be a great contribution you could make to the community. There’s an old pull request here that would be worth looking at too.
The Inform folder has Documentation, Extensions, Projects, Telemetry, and Templates subfolders. On Windows Inform is a subfolder of your Documents folder, but I don’t know where it is in other OSes.
At the moment that will take a little bit of manual work sorry, but only a little. Copy index.html and style.css into the Parchment folder. Then convert the .glorb to a .glorb.js file with this tool (or one of these other methods) and put it in the Parchment folder, and then edit index.html to refer to it instead of "./gargoyle-text.ulx.js". All the files need to be in one folder for it to work when running locally from a file: URL.
It, ah, turns out that the file has to have a .ulx.js suffix or Parchment won’t like it.
I’ve found my first Parchment bug! When I resize the browser window narrower, there’s a JS console error, and the game stops responding to input.
To reproduce:
Use this base64’d JS of The Wizard Sniffer. story.ulx.js.zip (535.1 KB)
Launch the game so you see some text. Now resize the browser window narrower and press the Enter key.
You’ll see a JS error on the console:
main.js:1 Uncaught RangeError: Invalid array length
at ae (main.js:1)
at ae (main.js:1)
at Object.w [as accept] (main.js:1)
at de (main.js:1)
at _e (main.js:1)
And pressing keys in the game now just prints a console log message: Not sending repeated generation number: 2
I definitely want more options like that. For now this is meant to be a drop-in replacement for the Quixe template, so it will have a side bar, but otherwise use up the width of the window.
The problem with images not appearing is most likely because the blorb conversion strips the images out.
In order to get them back you need to run the blorbtool.py script, which extracts the images and generates the interpreter/resourcemap.js file.
The steps are explained in several different comments here. (Background here.)
Edit: although having said that, it appears that isn’t sufficient in this case. Trying it out on my own unreleased story that uses graphics it still doesn’t show any of them. (This appears to be that, as far as I can tell, there’s no way to set the image_info_map with the Parchment template.)
rearrange events breaking things (caused by a very dumb typo)
image support (another dumb mistake, tested with the JSified Counterfeit Monkey.gblorb Dan provided, though I think it should also work with extracted images, you’ll just have to overwrite resourcemap.js with blorbtool.py like you would for the old Quixe template.)
I would’ve caught these errors if I’d tested a little more widely, so thank you for your patience with me!
Get the updated template from the same link in the first post.
Yep, images are working now, and layout seems to be behaving like Quixe. (Which is to say, still misbehaving on my particular story, but that’s probably something I’m doing wrong. Though it works ok in the IDE.)
Something else I’d like your opinions on is on styling. Currently this uses Quixe’s default tan-coloured status line. The new stylehints system can properly handle reverse styling in the main window and in the status window, though the stylesheet doesn’t currently enable that. I could enable it and keep the tan-colour, or I could switch to a more traditional black or dark-grey with white text. Any opinions on what would look best and be most readable? (The stylehints system will also allow for darkmodes, which I’m keen to add, but probably after IFComp.)
If you’re thinking about color themes, I think a good starting point might be the Visual Studio Code built-in color themes.
VSC’s default theme is a dark theme, but it has a handful of light themes built in; it seems intuitively right for Parchment to go with a light theme by default. Take a look at the Quiet Light and Solarized Light themes for inspiration. Look at their status bars in particular.
(Related: I don’t know whether this is required by some standard or other, but all of the popular IF interpreters I’m aware of render the status window in a monospace font. Why is that? It looks ugly/wrong.)
Well the interpreters have to use a grid window if the stories tell them to. And the stories tell them to because there’s no other way to align text. It would be possible to split the status window in two horizontally, with the left window being left aligned and the right right aligned, and then you could use buffer windows. But there’s a lack of interpreter support for text alignment (Gargoyle and Quixe don’t. Though I plan to add it to Quixe.) So it could be done, but it would be a lot of fiddly work for arguably not much benefit. Many years ago I started work on an extension to do it, but I stopped when I realised Gargoyle didn’t support it. But, maybe this can change in the future.
A grid window is a grid of characters, with a set width and height, and therefore are necessarily monospaced. You can print at a particular set of coordinates. You can centre and right align text in grid windows by getting the window’s width and calculating the coordinates you need.
Buffer windows don’t have coordinates, you just print text at the end of the window. In theory you can change the alignment of text in buffer windows, but as I said, some intepreters don’t support it.
We could perhaps convert some of the common grid window patterns (left and right texts, a single centred text) into proportional-spaced fonts, but any custom design (adding exits, or a compass, things like that) would have to keep the grid window as is. Lots of ways to experiment, but maybe after the comp.
Oh, and I remembered one of my ideas for a theme, which was to change from reverse text in the status window to a underline like you’d see in many books.
Speaking of stylehints: this does appear to have the same issue as Quixe, where using Glulx Image Centering by Emily Short to try to center an image in a standard text buffer window (by trying to use the center-justified hint in a special style) does not actually center the image, but leaves it left-aligned.
This technique works in the IDE terp and in Git. I haven’t tested any others.
I assume this probably needs to be fixed in Quixe. Just seemed worth mentioning.
Quixe didn’t have any stylehint support, at all. This template now has basic stylehint support, by which I mean the stylehints that are applied to individual characters, but not the ones applied to paragraphs. It probably won’t be too hard to add them, assuming no bugs come up I’ll work on that next.