Vorple version 3.1 available

I’d venture it’s a good name - I didn’t even realize it wasn’t an actual Infocom spell until just now.

1 Like

From what I guessed, it comes from the Vorpal sword mentionned in the poem Jabberwocky (Lewis Carroll).

The hints that led me to this conclusion:

Now, why this name was chosen, and why “Vorple” and not “Vorpal”, we’ll have to wait an official answer.

2 Likes

The reason is somewhat convoluted and uninteresting, I’m afraid. The early proof-of-concept demos used Google’s Closure library which has “goog” as its main namespace. The custom “Vorpal” methods used similarly the “vorp” namespace. Therefore because goog --> Google, then vorp --> Vorple.

Naming tools and interpreters after Infocom spells was already in decline, and I didn’t want to tie a “future-oriented” thing too much to the past.

2 Likes

So I’ve gotten Vorple up and running and tried a few examples. There’s one piece of functionality I don’t really understand: whenever I click on the “>” prompt (any example really), I get a hover menu containing a few commands (presumably some of my commands, but oddly enough not the latest). What’s happening there? Can I change that behavior? The Vorple source itself yields no obvious clue.

I think that’s the browser’s autocomplete feature that suggests past input when you focus on the input field. You can disable it by editing the Templates/Vorple/(manifest).txt file and changing line 69 to:

    <form id="lineinput" autocomplete="off">

That’s interesting! Is there documentation that covers this and similar functionality?

There aren’t many other relevant options, but they’re listed at MDN here, here and here.

I am not sure if this is the right forum to ask this question. But is it possible to import data from an excel file into a table in inform 7 using the latest version of vorple?

1 Like

It should be possible, but quite a complex task. Roughly the process would be:

  • Parse the Excel file, possibly with something like https://github.com/SheetJS/js-xlsx . If you can use e.g. CSV files (exported from Excel) instead, that would make it somewhat simpler.
  • Write a table from Inform to an external file (see ch. 23.13. in Writing with Inform). Read the file (see below) and replace the contents in JavaScript with whatever data you want from the Excel file. The structure must be exactly the same as in the file that came from Inform (same columns and data types) and the first one or two lines which include an id (possibly the IFID, I don’t remember exactly) that lets Inform load the file correctly later.
  • Save the file and read it from Inform as per the same chapter, 23.13.

Files are saved into a virtual filesystem so you’ll have to operate it using methods documented here: https://emscripten.org/docs/api_reference/Filesystem-API.html#id2

So it’s quite a lot of work and requires some familiarity with JavaScript. Depending on the ultimate goal, another possibly easier option would be to parse the Excel file and send the data to Inform using normal Vorple methods, and then set the table data inside Inform with custom code instead of the automatic table import.

1 Like

Another unrelated question.
I am trying to add a pre-test and post-test to my game. Is there a way to block the user from playing the game until they have completed the pre-test?
PS: I am planning on using another webpage containing multiple choice questions for my pretest.

The easy solution is to just have the link to the game at the end of the test. The second easiest is to have the game ask for a password at the start and give the password when the player has completed the test. Something like this:

Password accepted is a truth state that varies. Password accepted is false.

When play begins:
	say "Please give the password."
	
After reading a command when password accepted is false:
	if the player's command matches "swordfish":
		say "Password correct!";
		now password accepted is true;
	otherwise:
		say "Incorrect password, please complete the pre-test to get the password.";
	reject the player's command.

This was really helpful. Thanks so much. :slight_smile:

Do we now have access to game transcripts in vorple?
Also, is there an instance id associated with a particular instance of a game/story? As in, when a user attempts playing a game, is there a game session id that is created, which differentiates this attempt from the other attempts of the user at this game? If yes, how to access this value?

Transcripts are not yet supported. What happens when the player tries starting a transcript is described in this issue on Github.

I guess a workaround would be to use JavaScript to store somewhere all the text that is added to the HTML element containing the game.

As for the second question, I don’t think there is a ID associated with each game “instance”, but you could generate one by executing a JavaScript command in a when play begins rule, or a Vorple interface setup rule depending whether you want one unique ID per page reload instead of play.

So if I use a rule in “when play begins”, to generate an ID for that instance of the game, would it work even if a player saves and restores the game later. As in, in case the user restores a previously saved game, would the game still have the same ID?
Also, where is the game saved when a user saves a game?

If you store the ID in a Inform variable, then yes, restoring a game will also restore the game’s ID. Something like the following; I haven’t tested but it should show the basic idea.

Game's ID is initially "".

When play begins:
	execute JavaScript command "
		window.gameId = someFunctionThatReturnsAUniqueId();
		return window.gameId
	";
	now game's ID is the text returned by the JavaScript command.

But it won’t restore the ID on the JavaScript side. To do it, you would add, as per the documentation:

Vorple interface update rule:
	execute JavaScript command "window.gameId = '[escaped game's ID]'".

Obviously, if you only need the ID on the story’s side, then you don’t need JS, you could do it in Inform.


Saved games are stored in indexed DB (data stored in a local database). You can see where by using the developer tools of your browser. If I recall correctly, it’s in the entry gamedata_[checksum], where [checksum] is a unique ID based on your story file.


All of this is quite technical and I don’t know how much you know about JavaScript and web dev in general, so feel free to ask more details. (Disclaimer: I’m not a web dev, I just learned by myself, so other people may have better solutions than me.)

I’m enjoying getting a grasp of Vorple, and have a question about the Command Prompt Control Extension. Its documentation suggests that the “hide the prompt” command is “not useful unless there’s custom JavaScript code involved” and discusses using custom javascript to unhide the prompt when some other action is complete. But what if you’re wanting to create a game where all input is handled by Vorple hyperlinks of the “without showing the command” variety, and you handle clearing the screen for text/scene changes manually? Ie, what if you just want to hide the prompt for the entire game?

In some initial testing, it seems using “hide the prompt” in “When play begins”, and then using Vorple hyperlinks “without showing the command” works fine in this manner. Is it feasible to handle a whole game this way and never unhide the prompt, or is there some technical downside to doing so?

Yes, that should work just fine. The documentation just tries to say that unless there’s something set up to continue the game instead of player typing commands on the parser, there’s no way for Inform to unhide the prompt on its own. But if you use only hyperlinks and want to disable the prompt completely then it’s not a problem.

1 Like

A question about Vorple.

I am running a sort of ARG that focuses around an Interactive Fiction on my website. However, the players are bypassing a lot by simply downloading the zblorb file, reverse engineering it, and then just reading descriptions of things, and seeing if anything has changed. The game gets updated live on the website through an automated build process I set up.

I love that vorple will let me run my own Javascript. I have set things up so that I can use modern build systems with ES6, and just run commands I have set as a global on the window. I am using it for music, images, hopefully some more advanced integrations, even possibly use it to puppet the responses at some point through websockets and a live chat sort of flow, but making it look like it is still the game.

However, I am trying to prevent my players from cracking the zblorb file. I wanted to move it to the server side, but that would mean I can’t use vorple, which is great. I was thinking of trying to create a layer inside vorple or parchment to relay the message to the server for me, but not sure if that is possible or where in the code I might look.

Thoughts or suggestions greatly appreciated!

There aren’t any bulletproof ways to prevent people from digging up the story text, apart from having everything come from the server. Here’s a couple of ideas to make it at least harder:

  • You can use Ajax to fetch text snippets from the server. You can look at the Scrambled Eggs and The Sum of Human Knowledge examples in the main Inform 7 extension or in Inform 6 examples directory, and combine fetching the data in the latter with replacing story content in the former (create an empty element, fetch the text from the server, fill the element with the text.)
  • Take advantage of the fact that while it’s easy to extract text from the story file, it’s hard to extract and follow game logic. You could scramble or encrypt the text and unscramble/decrypt it for printing. If you use some obscure scrambling mechanism, it would be hard (but not impossible) to figure out how to reverse it based on just seeing the scrambled text.
  • Add “decoy” content: Inform doesn’t do dead code elimination so anything that’s in the source text shows up in the text extracted from the story file, even if it’s never used anywhere. There’s no other downside than a small increase in the filesize. For example, if the important information is “the treasure is in the sunken pirate ship”, add a bunch of:
To say decoy1: say "The treasure is in the abandoned church."
To say decoy2: say "The treasure is in the bank vault."
To say decoy3: say "The treasure is under the kitchen floorboards."
....
  • Same as above, but run the whole story text through a Markov generator (e.g. https://www.dcode.fr/markov-chain-text), maybe mixed together with some unrelated but similar text body, and copy-paste the results as “to say” definitions (or routines in I6) to random places in the source text. If there’s enough text it would be hard to tell which parts are real and what’s just nonsense.