I’ve been stuffing about all day trying to get Parchment working with a z5 file and I’m not even close to getting it working.
I’ve tried the build from Inform 7 technique. No luck. I’ve tried downloading the latest build from GitHub. No luck. I’ve tried setting default_story: 'story.z5' and get a blank page. I’ve created the base64 JavaScript file and tried setting default_story: 'story.z5.js' and get a blank page. I’ve tried setting default_story: [ "interpreter/story.z5", "interpreter/story.z5.js" ] and get a blank page.
I’ve tried the web version. No luck. Using the first two default_story settings above, I get ‘Unknown storyfile format’. Using the third setting, I get ‘InvalidCharacterError: String contains an invalid character’. The developer’s console indicates this is because of ‘Uncaught SyntaxError: illegal character U+0005’ in the z5 story file.
I’ve scoured intfiction.org and the GitHub repository and done a Google search and I can’t find any installation guide or tutorial or instructions anywhere. The only thing I can find is the brief info on options in the wiki and this is far from complete. It doesn’t even give you formats or defaults or what the constraints are.
Of all the various files in GitHub, I can’t work out which JavaScript and css files are required in which circumstances or what they do. The range of Inform 7 and web files are different.
So, what’s the secret to getting this working? Someone must know.
I followed Zarf’s instructions to create a minimal Inform 7 game (including the release with interpreter thing), then replaced the story files with my files and changed the filenames in play.html. The resultant page just shows the ‘Parchment’ title followed by 'is an interpreter for Interactive Fiction. Find out more., plus the side bar. The play.html page is chock full of html errors and the link is broken. There is no updated version of this file on GitHub.
If you’re able to upload it then I can take a look. But if you’re not releasing it from within Inform 7 itself, then just use the new ifsitegen.py tool.
Zarf’s script doesn’t help, as it still relies on the Inform 7 files. I’ve just noticed that play.html loads parchment.min.js, but there is no script by that name. Which scripts should it be loading?
I downloaded the latest version of Inform 7. (Mine was apparently out-of-date. I wouldn’t know, as I never use it.) When including the interpreter, it now creates the parchment.min.js file and I’m able to run the game in a browser, but there’s an io exception, specifically ‘Uncaught TypeError: this.io.input is not a function’ in the afore-mentioned file.
So does anyone have a play.html file that actually works with the latest Parchment scripts? There isn’t one on @Dannii’s GitHub repository.
If I set default_story to story.z5.js, I get ‘Unknown storyfile format’.
If I set default_story to story.z5, I was getting ‘InvalidCharacterError: String contains an invalid character’ and ‘Uncaught SyntaxError: illegal character U+0005’, but now I’m getting the same as above.
I should probably mention that I’m using Firefox 88.0 (64-bit) in case that makes a difference.
Make a minimal new I7 project, let’s call it “TestProject”:
Release along with the "Parchment" interpreter.
The Lab is a room.
(But don’t release yet.)
Edited to add: Create a Templates subdirectory in your project’s Materials directory. (thanks to Garry for pointing this out below)
Unzip parchment-for-inform7.zip into that Templates directory, so that you now have: TestProject.materials\Templates\Parchment
Release the game in Inform 7. A directory called TestProject.materials\Release will be created, which contains index.html and play.html and a subdirectory “interpreter”.
Go to that directory and execute: python game2js.py yourgame.z5 > yourgame.z5.js
Important: We don’t use the --giload argument on the command line here, because that’s for a slightly different way of including the game file later, see the comments in the python script. (Depending on what we do later, including the file resulting from --giload would result in the “String contains an invalid character” error that you mention.)
I was initially confused by this as well, due to this post Parchment for Noobs - #4 by zarf
where zarf gives an example with the --giload argument.
Copy yourgame.z5.js into the directory TestProject.materials\Release\interpreter. (And delete the file TestProject.gblorb.js.)
Open play.html in TestProject.materials\Release with a text editor and replace the game’s filename, so the lines:
That error is probably caused by requesting input while in the upper window. That functionality is unsupported in the built-in template of Inform 7 6M62 has, but later updates from Github will support it.
You’re a bloody champion! Thank you, thank you, thank you. I got it working. I think the key was to:
Include "Parchment" in the first line of the test project so that it knows exactly which interpreter to include. I’ve never seen this mentioned before.
Delete the existing Inform 7\Internal\Templates\Parchment folder and unzip the downloaded parchment-for-inform7.zip file into the Inform 7\Internal\Templates folder. I had seen reference to the Templates folder, but I just thought this was a generic description. I had no idea that it was tucked away in the program folder’s structure.
Delete all the old files from the game.materials\Release folder.
Don’t use @Dannii’s online script (which is what I had used), but use @zarf’s game2js.py python script without the --giload option.
Buy yourself a crystall ball so that you can look into the minds of the Parchment developers.
Edited: Changed point 2 after discovering the existence of the Templates folder.
The .z5 file works directly for me, no need to convert it to .js.
However, I don’t know how to target a particular game from a URL:
https://my_website/parchment/?story= …
It doesn’t work.
Does anyone know how to make the with option work to limit the number of characters displayed per line which was in the form <script>parchment_options = {width: 56};</script> which now no longer works?
I can’t get that working with the current Parchment. I have to use the base64 encoded Javascript version.
Are you using an old version? If so, perhaps something is broken in the current version. I just get InvalidCharacterError: String contains an invalid character. The web developer tools indicate that this is due to Uncaught SyntaxError: illegal character U+0005 in the z5 file.
This error looks like the story file has been inserted directly into some JS code without base 64 encoding. Or the story file was renamed to .js without any processing?
No, @auraes was talking about the raw z5 file, not the base64 encoded one. The options doco indicates that this is possible, but it doesn’t work. The examples given are default_story: 'stories/mygame.z5' or default_story: [ 'stories/mygame.z5', 'stories/mygame.z5.js' ]. Is this right or wrong?