passing parameters into a game

I have created a story with Inform 1.53/6.33/6L38 on Mac and have released it as a zblorb so that it can be played in a web page using the Parchment javascript interpreter.

I’m wanting to find a way to pass a parameter to the interpreter on invocation that will enable me to set the starting room of the game. Does the VM support this kind of functionality?

We’re making a locative experience where people begin in different parts of the game world depending on where they are in the real world, using GPS on mobile devices to do this.

Rob

My first thought is add a verb “__relocate xyz” or such, and alter Parchment so it passes that as the first input into the game.

Thanks Daniel, can you link me to any code that I could use to understand how to do this?

Rob

Since you have a Z-code project, you can use Vorple and its sendSilentCommand method in the JavaScript API (vorple-if.com/vorple/release/doc … entCommand) which does just that.

Another option is to just compile different versions of the story file for each starting location. If there aren’t that many you can do it manually or make a build script, which is not trivial but relatively simple if you’re familiar with the command line and scripting tools.

Thanks Juhana, great! I’ve built the story with vorple/parchment and I can run the command via javascript. I found this thread: [url]https://intfiction.org/t/inform-7-teleportation/2286/1] that describes how to make a Teleport command to change rooms. I have created the first room as:

Begin is a room. "".

Then in the page I added the javascript:

vorple.parser.sendCommand("teleport to garden", {hideCommand: true});

And that works!

Rob

One more suggestion with that system: you can make the Understand line conditional.

Understand "teleport to [any room]" as teleporting to when the turn count is 1.

This means the player will never be able to use it; the parser won’t even understand it after the first turn.

JSZM also runs Z-code story files in JavaScript (ES6 is required), and such a thing could be done as: function*my_pass_parameter() { game.read=my_input; return "69105"; // Replace this with the input you want }; game.restarted=function*() { game.read=my_pass_parameter; }; In JSZM, it is up to the front-end to echo the user’s input, so this way will hide it. It will also work if the game is restarted.

(However, note that JSZM does not and will never support Blorb (XJSZM will provide hooks for implementing Blorb and other formats in the front-end though). My note here is to show another way for future reference.)

Yet another way would be for your loader to tamper with one of the memory locations before passing the game file to the interpreter.