Ifsitegen.py

Thanks! I still think the relationship between “website” and “interpreter” is pretty confusing in Inform though, haha. Releasing with a website just creates the information index page, while releasing with an interpreter also releases with a website, and both the index and the play pages use the website template.

So to use a non-default layout for the play page in Inform, you actually have to write Release with a "OneColumn" website and an interpreter (and then delete the index page and rename play.html to index.html to achieve what this script does). Is that about right?

I am not experienced in Windows programming so it took me some time to figure out what to change in ifsitegen.py to make it work on a 64-bit Windows 10 machine.

I simply had to change part of the path in line 180 from:

/Program Files/
To:
/Program Files (x86)/

One question: As Parchment also can handle Hugo, TADS and Adrift 4 games, would it be simple to make ifsitegen.py handle such files too?

1 Like

Unfortunately no, because the templates only include interpreters for Z-code and Glulx. And because the other interpreters use WASM it would also be harder to make them run from local file: urls. Not impossible, but not simple.

2 Likes

Ok, thanks :slight_smile:

Had a go with this for the first time today. I can get it to work with the basic python ifsitegen.py mygame.z5 but if I add any of the options for author name, title, etc., it won’t produce any output. Anyone have any tips?

2 Likes

I presume you’re doing this in order to get a game running in Parchment. If so, this thread is very useful. You can skim the whole thread, but most of the best stuff is in the solution by @StJohnLimbo.

Using Parchment is a dark art. I struggled with it for weeks and wasn’t able to get my page looking quite how I wanted it. If you need any further help, do a search for Parchment or send me a PM and I’ll help you get started. I have to get back into this myself anyway in the next day or two.

3 Likes

I tried the solution in that thread but ended up with a game page stuck on ‘loading’. I’ll give it another go today to see if I did something wrong, but if I can’t get it to work I’ll message you. Thanks!

Assuming Windows is your operating system, try the following:

  1. Update Parchment that came with Inform 7 to the latest version. You can do so by downloading the current package from here Parchment for Inform 7.

  2. For the Puny BuildTools I created a simple Windows Powershell script that automates building a game using Ifsitegen.py. It also cleans up the the old version before it builds new. You probably need to apply other directories but in general, this should hopefully work for you. Just place this script in every project you’d like, alter it one time and you’re good to go. Puddle-BuildTools/modern.ps1 at master · ByteProject/Puddle-BuildTools · GitHub

PS: Python and Powershell needs to be installed on your Windows PC of course. I think Powershell is installed by default now and Python you get from the Windows App Store. I am using Python 3.9 on my machine.

2 Likes

I’ll have a look at that. Thanks!

1 Like

Just curious, where would you like to play your game online? I am asking because, depending on what you are trying to do, you may not even need a Python script.

If you want to have a standalone Parchment page on your own web site or somewhere like itch.io, then you need to go through the scripting process to convert your z-code game to base64 (with a little bit of Javascript).

Similarly, if you want to customise the look of your page with a custom layout, colours or what have you, then you can only do this by customising the html and css files.

1 Like

Regarding itch.io, just to understand, what is the drawback of doing something like this:
Adrift 4 demo using Parchment on itch.io by kenped

I mean, you use itch.io for customizing the webpage around the Parchment window, whereas inside the Parchment window you have Parchment running which you can’t customize.

I am only aware of one drawback which may be important to some, and that is you must have put your z5-file somewhere else online than itch.io.

There’s nothing wrong with that if you’re happy with the boring black on white text provided by iplayif and you have somewhere to host your story file.

Take a look at one of mine for a different approach:

The theme matches the theme of the game page and everything is hosted in the one place, whereas your method requires three different web sites.

1 Like

Ok, I see that you can change the text and background color of the game itself which is neat. I did not know that. On the other hand you loose e.g. the pretty leaves surrounding the game window for Kenny Koala, though that would be possible to fix with some more html-coding if you are good at it.

I don’t see the problem in getting data (interpreter and game) from other sites, though I do see a problem in having to update the story file on another site which may be a lot slower to access such as the IF Archive where it takes several days before a game is updated. So that problem would depend on your options for hosting the story file somewhere else. I personally use the Adrift site where I am also in full control of my files.

In the case of itch.io, you can run the game in an iframe (which is what I think you’re doing) or you can run it in a full page (which is what I’m doing) so that you get to use more screen real estate. The point is that you have options and you can use whatever option suits you best.

1 Like

Yes, it’s for itch.io. Ideally I’d want to customise the CSS as Garry describes, but for the moment I’m just looking at all the options and trying to get something working.

2 Likes

Managed to get it working in a way I’m happy with for now (have tried it out with Morris on Itch). Thanks for your help everyone.

3 Likes

Looks great :smiley:
I can see the advantages of being able to customize so much.

1 Like

Nice! :+1:

It’s interesting that you got it working with an older version of Parchment (2021.11, going by the number in the lower left of the window).

I first tried it out with the later version 2022.8, which comes with the latest release of Inform 7, and it didn’t work. However, the very latest version 2023.3 from Github fortunately does.

So, for people coming across the thread in the future, two things might be worth mentioning explicitly:

1.

As Stefan said above, download the latest version of Parchment for Inform. Put the zip file in the same directory as the Python script and call the script with the argument -i parchment-for-inform7.zip.

2.

I don’t know if it’s the same issue which you describe, but to inject author and title into the template, the command line options on Windows (in the normal command prompt) have to be slightly different from the syntax given in the OP.

Instead of --author 'Firstname Lastname' in single quotes, one should use double quotes: --author "Firstname Lastname".

So, putting it together:

python ifsitegen.py -i parchment-for-inform7.zip --author "Firstname Lastname" --title "My Title" mygamefile.z5
3 Likes

I did actually use the latest version of Parchment but perhaps the text hasn’t been updated in the code!

Edit: yup, found it. I would need to update it manually in play.html.

Edit 2: and that makes sense about the Windows command prompt too, thanks for that.

2 Likes