Any way to use parchment on android with downloaded files?

(Brian Rushton) #1

I’ve noticed that parchment urls just point to an online blorb or z machine file, so I assume it just reads it in. I’m trying to find a way to play Blue Lacuna on android (for my post series), and I’ve been having trouble doing it. Is there any way to direct the parchment url to a file on local storage?

#2

It might work if it the gblorb is in the same folder as index.html, but web browsers are pretty temperamental when it comes to running stuff from the local file system. (The same will apply to using Quixe directly)

#3

You could also give a shot at running a webserver on your device to serve the local files. A quick Google shows some Android web servers.

(Andrew Plotkin) #4

You can transform the zcode file to a JS-data-format which Parchment can always read from the local filesystem. (I7 does this when building a playable web page.) It’s the zcode2js.py script in parchment/tools.

#5

Correct me if I’m wrong, but doesn’t that just base64-encode the binary file (so it can be represented in 7-bit ASCII)?

(Andrew Plotkin) #6

It does that and then wraps the base64 string in a processBase64Zcode(’…’) function call.

#7

Ah, okay. I made a shellscript that used some creative ‘sed’, ‘head’, ‘tail’, and ‘wc’ to cut everything except the base64 string and then decoded it. Since I am on Android, python was a luxury I did not have easy access to (just busybox and a ‘base64’ binary I compiled).

This was for automatic decoding of encoded files, though… kinda the reverse of what you want here.

It’d probably not be hard at all to accomplish the reverse in a shellscript. Easier, even.

#8

I have manage to do that in two ways:

  • making an index.html that points to parchment.html=?story…
  • Adding the adventure file in the script (see below an example for A Mind forever Voyaging).

If you put everything into a folder: www

[code]+ www
-index.html
-amfv.z4

  • /lib
  • jquery.min.js
  • parchment.min.js
  • parchment.min.css
  • gnusto.min.js
    [/code]
    and install nodejs on your system, and npm install -g cordova
    Once you have cordova installed, you can move to the folder you have the www in, and do:
 cordova add platform android

wait for everything to download. Once done,

 cordova build --device android

and you will get a prety apk with a webview that opens index.html

[code]

A Mind Forever Voyaging

Parchment

is an interpreter for Interactive Fiction. Find out more.

Parchment requires Javascript. Please enable it in your browser.

[/code]