Programming Inform7 using VORPLE

I’ve tried VORPLE in a web-based adventure with graphics and sound.
In short… IT WORKS! Juhana has done a first rate job on this piece of code.

I’m starting this post for others, like me, who are experimenting with this new interpreter and want to share their experiences.
There are still a few capabilities that seem to be possible per the fairly limited documentation and would be very handy.
Some obvious ones are buttons, tabs and menus.

So whether the capability is there and not yet fully documented or maybe still waiting to be written, please jump in.
I’d really like to hear about what you’ve done and solutions you’ve found.

Here’s something interesting.

In Vorple, if one uses:

Then issues some commands and then triggers:

The screen does not fully clear.
There is often some preceding text left.

The extension uses:

It looks like this may indicate that there is a “misalignment” in what Basic Screen Effects thinks its clearing and that to which it is applied.
You’ll notice that the call is to the Virtual Machine, which knows nothing about a webpage.
Perhaps the solution is to write a Vorpl’ized version of the Basic Screen Effects and make use of Javascript and html code.

Technically the VM is aware of the webpage, but only Parchment’s part of it. Vorple is an additional layer on Parchment and the screen clearing command doesn’t reach it.

That is the plan; until then here’s a cross-interpreter screen clearing solution.

[code]To clear the/-- Z-machine screen:
(- VM_ClearScreen(0); -)

To clear the/-- screen:
if Vorple is supported:
eval “$(’#vorple’).empty()”;
otherwise:
clear the Z-machine screen.
[/code]

(tabs not preserved in the forum code: one tab before “if…” and “otherwise:” lines, two tabs before “eval…” and “clear the…” lines.)

Thank you Juhana. Those clear screen routine do exactly what I was hoping to do.

Here is an observation about the use of “modal” dialog boxes, such as those used to display credits and the about box in the Vorple examples.
I’ll post such notes, here, until I’m sure there is a bug to be fixed and it’s not a problem with my programming.

When displaying a modal dialog box, the "focus" for the next action/keystroke is not placed on the "Ok" button as one might expect. Suspect that this is due to not yet having the ability to accept single keystrokes in Vorple. From what I've read about Vorple, I think this might be an issue with the underlying Undum on which Vorple appears to be layered.

That is caused by the interpreter hogging the keyboard focus, and there’s no mechanism yet to have it release the focus to another element on the page. (There is no Undum involved at all with the Inform version of Vorple.)

Thanks for the explanation, Juhana.The keyboard hogging is more an annoyance than a serious issue.

I’m putting together a test adventure to work out some of the things I need to do in the full-up one.
Am working on a way to get a menu to stat up when the adventure starts. Most things except the meaning works.
If I try to put in a “try” statement for the menu command in a “when play begins”, I get subsequently the credits coming up in the play area rather than in dialogs.
I’ve tried playing with saying “normal” and “dialog”, but it doesn’t seem to help.

I have managed to get the initial page to display the initial menu on startup, plus display dialogs as they should be.
However; I would like to remove the announcement of the VORPLE version that gets appended to the initial menu.
I’d like to keep the initial screen “clean” and have provided all that info (and more) in the credits dialog.

(Note: I’m employing sections of the Vorple Examples to reduce the potential for errors on my first pass. So, the displayed text will seem familiar.)

Below, I’ve included the code snippet that implements the initial screen and dialogs:

[code]Volume Menu

[Have labelled each section as a Volume just for convenience in the initial runs.]

[‘Nullspace’ is my name for the ‘Room’ in which out-of-world menu actions to take place]
Nullspace is a room with the printed name “”.

[The following rule gets ride of most of the header info, which seems to get printed AFTER the menu.
I’ve not found any way of adjusting it’s placement, so I had to suppress it altogether.
This, however, still allows ‘Vorple 2.4’ to be printed right below the initial menu.
Since this is already displayed in the storyfile info, I’d like to eliminate it from the main screen.]
Rule for printing the banner text: say “” instead.

When play begins:
try displaying menu.

Displaying menu is an action applying to nothing.
Understand “Menu” as displaying menu.
Carry out displaying menu:
now the player is in nullspace;
say “Menu:[line break](click or type one of the following)[paragraph break]”;
say " 1) [run paragraph on]";
display “About” linking to command “About”, without showing the command;
say “[line break] 2) [run paragraph on]”;
display “Credits” linking to command “Credits”, without showing the command;
say “[line break] 3) [run paragraph on]”;
display “Play Adventure” linking to command “Play”, without showing the command;
say “[paragraph break]”;
mark the current action “normal”.

Volume About

Showing about is an action out of world.
Understand “about” and “info” as showing about.

Carry out showing about:
say “[bold type]‘The Seven Liberal Arts and Sciences’ series (Part 1 of 7)[roman type][paragraph break]”;
say “[bold type]GRAMMAR[roman type][paragraph break]”;
say “[italic type]by Die Gebrüdern Rätsel[roman type]”;
mark the current action “dialog”.

Volume Credits

Crediting is an action out of world.
Understand “credits” as crediting.

Carry out crediting:
try requesting the story file version;
say “[bold type]Vorple[roman type] by Juhana Leinonen (MIT license)[line break]”;
mark the current action “dialog”.

Volume Play

Playing adventure is an action out of world.
Understand “Play” as playing adventure.

Carry out playing adventure:
now the player is in the Omniverse;
mark the current action “normal”.
[/code]

You can remove the banner completely by unlisting the rule that prints it.

The display banner rule is not listed in the startup rulebook.

This is preferable to overriding the banner text rule completely with a rule that does nothing.

Removing Vorple credits is done by unlisting that rule.

The display Vorple credits rule is not listed in any rulebook.

Thanks, Juhana. That worked very well.
Yes; setting the rule to a null string was a bit sloppy.
I was just trying to get it to work.
The good news is that I’m slowly coming up to speed and getting the desired results a bit more quickly.

By the way;
Is there any documentation or examples on the way to use any of the following:

  • Vorple Buttons
  • Vorple tabs
  • Vorple Button Groups

Or are these just some partially implemented solutions for the next release.
I can do without, but they would be really nice to have.
They might give me a way of doing a static menu unaffected by the scrolling area.

I’ve read a fair bit on your website, but the documentation is still fairly sketchy and there are no obvious examples.

The other smaller question relates to whether the added Vorple rules etc are documented somewhere.

Small advance by small advance…
I’m starting to find useful snippets in a number of places.

Now I have the crediting dialog working the way I wanted:

[code]Volume Credits

Crediting is an action out of world.
Understand “credits” as crediting.

Carry out crediting:
try requesting the story file version;
say "[bold type]Vorple version ";
say span “vorple-version”;
eval “$( ‘.vorple-version’ ).html( vorple.core.version+’.’+vorple.core.release );”;
say “[roman type][line break]by Juhana Leinonen[line break](MIT license)[paragraph break]”;
mark the current action “dialog”.
[/code]

The files in the library are residual from the development, so unfortunately there’s nothing usable yet.

The rules are named in the extensions’ documentation, but generally there’s no need to mess with them.

Thanks, Juhana.

The later question was just to allow me to figure out how to do things by example.
For instance, I got the banner removed and had to create a way of adding the Vorple version back into the credits screen.
So; I looked at your code as a guide.

A bit of an update on browser compatibility:

Computer O/S: OSX v10.8.5 build 12F45

Browsers Tested with Vorple v2.4:

Safari v6.0.5 (8536.30.1):
I have thrown everything I would typically use at VORPLE on this platform and it still works. Rock-Solid so far. :smiley:

Firefox v24.0
This version works on almost everything, but sound. It refuses to play any of the .mp3 files I’ve tried. :confused:

Will try the latest Internet Explorer and Chrome a bit later.

It seems that most Mac and Windows users like Firefox better than the default browser on their platform. So the Firefox issues are a concern.

Last I checked, Firefox refused to play MP3 files as a matter of policy. You can work around this by including MP3 and OGG versions of each sound.

Thanks for trying out the different browsers. The next version uses a different audio player than the current one and it should work in Firefox as well with a Flash player fallback. (If the user doesn’t have Flash installed there’s nothing that can be done except providing the OGG alternative.)

If you (or anyone else) wants to publish something before the next version is out, I can make an intermediary version that uses the new audio player.

Hi Juhana;

I just tried the current Internet Explorer running on Windows 8 and it performs perfectly.
So; the default browsers on the two main platforms (Mac and Window) both work just as they should.

As a side-note:
The adventure series I’m writing is a set of 7 puzzles.
The first six yield a set of GPS coordinates and a clue to the final adventure coordinates in the seventh puzzle.
I have the first adventure complete, including the extension necessary to support it and the remaining six adventures.
The second adventure is well into design and coding won’t take too long.

I’m splitting the task with a friend and teaching him object oriented design/programming as we go along.
Never thought about it much, but OOP seems mess with some peoples minds more than others.

Realistically; I think we’ll plan for a New Years Day release.
It’s a stretch target, but we need a target or we’ll not push ourselves enough.

I don’t know what your schedule is, but an intermediate version would be handy even before the adventure series is released.
It’d be handy to test the adventures on a platform that also offers a better platform for debugging.
Firebug Lite does not allow real-time editing of the CSS files on Safari.
On Firefox, I can run the full Firebug and try custom CSS file changes in real-time.
I also wonder if you’ve had any thoughts on the scrolling issue in modal dialog boxes (noted earlier).

(Just saw the note from zarf. The team writing Firefox is bound to annoy some people with that decision.
I’m sure they have all sorts of reasons, but I feel that they probably could have picked a better hill to die on.)

Tried these on the most recent version of OSX.
The same browsers are available for “Windoze” as well and often other platforms.

Problem Children:
Tried Google Chrome Version 30.0.1599.69 with Vorple 2.4. —> Everything works but sound. Same as Firefox. :cry:
Tried Opera v16.0.1196.80 with Vorple 2.4 —> Everything works but sound. Same as Firefox. :cry:
Tried Seamonkey v2.21 —> Everything works but sound. Same as Firefox. :cry:

Works Great (like Safari or IE)
Then tried Maxthon v4.1.0.3000 —> Things seem to work completely and perhaps even a bit faster than Safari or IE. ***** This one actually works !!! ***** :smiley:

Has any new functionality been added to VORPLE? Have not seen any status update in a while.

The reason is mp3 is a non-free patented technology, and would people like to pay to get a browser with mp3 audio elements?

stackoverflow.com/questions/492 … t-in-audio

it might change in the future (if it’s not already the case, I don’t use much mp3 so I didn’t test this)

(by the way ogg vorbis is a more efficient encoding format).

I tried also to play some sounds with Vorple, but it doesn’t work as expected (either in firefox or chromium):

When play begins: play ogg sound file "file01.ogg".