Images in parchment? With or without Glulx...

78 views
Skip to first unread message

weevil

unread,
Oct 8, 2009, 6:42:42 PM10/8/09
to Parchment
Hi, I have a piece of IF that I'd like to put online with Parchment-
This would be the only distribution of the game, a specially built
page with parchment running the game and CSS styling.

The game has images though (each chapter has an illustration), it's
currently set up as a glulx file, and from what I understand,
Parchment doesn't currently support glulx.

I was wondering if there might be a way around that limitation, by
instead having a seperate piece of javascript that inserts images at
prompts. So instead of using the regular 'display figure of' argument
in Inform 7, you could just write 'say "imageprompt00008" or something
that would then be replaced by the image.

Anyone tried this yet?

Dannii

unread,
Oct 8, 2009, 11:19:34 PM10/8/09
to Parchment
Yes! See Dan's recent 'Playing around' post.

DanMonroe

unread,
Oct 9, 2009, 9:38:57 AM10/9/09
to Parchment
Hey Weevil,

I was playing around with some display and did some proof of
concepts. Here is what I did to display an image inline. I've
included a portion of my additions to web-zui.js so you don't have to
view the source on my test page. I wouldn't call it release ready,
but at least it did display the images properly.

--Dan

in the I7 source:

[pictures]
A picture is a kind of thing.
A picture has some text called image_name.
The image_name of a picture is usually "".

Instead of examining a picture:
let IMG be the image_name of the noun;
if IMG is not "":
say "JQ:IMAGE:[IMG]:";
say "[the description of the noun][line break]";

The Mona Lisa is a picture in the Mainland .
The image_name of the Mona Lisa is "monalisa.jpg".


in web-zui.js:

onPrint: function(output) {
var styles = self._calcFinalStyles();

var continuePrinting = true;

// Handle new javascript hooks. Dan Added
var jqIndex = output.indexOf("JQ:");
if (jqIndex >= 0) {
continuePrinting = false;
var colonIndex = output.indexOf(":");
output = output.substring((colonIndex+1));
if (output.substring(0,4) == "INV:" ) {
var realInventory = output.substring(4);
var jqInventory = $("#inventory");
jqInventory.text( "" );
var lines = realInventory.split("\n");
for (var i = 0; i < lines.length; i++) {
if (lines[i]) {
var chunk = lines[i].entityify();
chunk = '<div>' + chunk + '</div>';
jqInventory.append(chunk);
}
}
} else if (output.substring(0,7) == "PROMPT:" ) {
var newPrompt = output.substring(7);
$("#command-prompt").replaceWith( '<span id="command-prompt">'
+ newPrompt + '</span>' );
this.last_prompt = newPrompt;
} else if (output.substring(0,5) == "SHIP:" ) {
var tokens = output.split(":");
if ( tokens.length > 2 ) {
var newShipDir = tokens[1];
var shipX = tokens[2];
var shipY = tokens[3];
var shipMessage = '';
if ( tokens.length > 3 ) {
shipMessage = tokens[4];
}
var shipDiv = $("#ship");
var newShipPos = ((140 + ( shipX * 20 )) + 'px ' + (60 +
( shipY * -20 )) + 'px').toString();
shipDiv.css( 'background-position', newShipPos );
}
} else if (output.substring(0,9) == "CSSTITLE:" ) {
output = output.substring(9);
var colonIndex = output.indexOf(":");
var titleCSS = output.substring(0,colonIndex);
styles = styles + ' ' + titleCSS;

continuePrinting = true;
output = output.substring((colonIndex+1));
} else if (output.substring(0,6) == "IMAGE:" ) {
output = output.substring(6);
var colonIndex = output.indexOf(":");
var image = "<img src=\"i/" + output.substring
(0,colonIndex) + "\" />";
$("#content").append('<div class="imageWrap">' + image +
'</div>');

continuePrinting = true;
output = output.substring((colonIndex+1));

}
if (colonIndex > 2) { // for leading \n
output = "\n" + output;
}
}
if ( continuePrinting == true ) {

self._log("print wind: " + self._activeWindow + " output: " +
output.quote() + " style: " + styles);

if (self._activeWindow == 0) {
var lines = output.split("\n");
for (var i = 0; i < lines.length; i++) {

if (lines[i]) {
var chunk = lines[i].entityify();

// TODO: This isn't an ideal solution for having breaking
// whitespace while preserving its structure, but it
// deals with the most common case.
// var singleSpace = / /g, singleSpaceBetweenWords = /(\S)
(\S)/g, backToSpace = /<&>/g;
// chunk = chunk.replace(
// singleSpaceBetweenWords,
// "$1<&>$2"
// );
// chunk = chunk.replace(singleSpace, '&nbsp;');
// chunk = chunk.replace(
// backToSpace,
// "<span class=\"z-breaking-whitespace\"> </span>"
// );

chunk = '<span class="' + styles + '">' + chunk + '</
span>';
$("#content").append(chunk);
}

if (i < lines.length - 1)
$("#content").append("<br/>");
}

self._scrollBottomWindow();
} else {
self._console.write(output, styles);
}
} // Dan Added
},

DanMonroe

unread,
Oct 9, 2009, 2:02:10 PM10/9/09
to Parchment
Of course, you can attach an image to anything (like your scenes).

A scene has some text called image. The image of a scene is usually
"".

Act One is a scene. The image of Act One is "actone.jpg".
Act One begins when play begins.
When Act One begins:
say "JQ:IMAGE:[image of Act One]:";

weevil

unread,
Oct 9, 2009, 2:15:54 PM10/9/09
to Parchment
Awesome! Thank you for sharing the js!! I'm going to change my glulx
figure statements to text and give it a try!

weevil

unread,
Oct 20, 2009, 11:32:57 AM10/20/09
to Parchment
One thing I would eventually like to do when I have my game complete
and I move on to building the site-

I'd like to have an image div that sits above the text. When images
are triggered from the story, I'd like them to sit in the image div
until they are replaced. I would probably sit the room name and score
inside there as well.

DanMonroe

unread,
Oct 20, 2009, 1:37:14 PM10/20/09
to Parchment
You can do pretty much anything you can dream of. You can mock up
your display and then have the IF game "drive" your display targeting
any HTML div you'd like. I know this is not what the Parchment team
is trying to achieve, but it's pretty easy to hook into.

Right now, I am doing a pirate themed game. The map display is an
image of a sea I created with several islands here and there. The
player moves a ship that is displayed with css on top of the map.
They use the mouse to click on directions that are on a compass rose
navigation image. The ship moves around the sea until it reaches
land. When it reaches land, it will switch over to the IF panel,
place the player in the appropriate room, and continue with the IF
text portion. When the player boards the ship again, it switches back
to the map display. I've got wind, clouds, night and day, and "sea
monsters" in there too for fun, but they are totally outside IF and
Parchment.

I've also done it in "chapters" where when the player lands, it will
load a different IF game based on the where they landed. This way, I
can build a much larger game, but keep it under the parchment size
limitations.

weevil

unread,
Oct 20, 2009, 3:16:22 PM10/20/09
to Parchment
Well, I knew I could theoretically do it, I'm just not a very good
javascript programmer, so I didn't know how hard it would be (I
usually rely on tweaking stuff from Jquery Tools or existing
plugins).

Your pirate game sounds really cool!

It may or may not be useful, but it would also be interesting to have
a parchment wordpress plugin- you could post snippits of IF to a blog
and have them run normally without a sludgy applet.

weevil

unread,
Oct 20, 2009, 3:28:17 PM10/20/09
to Parchment
And as for IF "purists" who view any kind of enhancement with
suspicion- if it has a text interpeter, it's IF. Get over it.

Atul Varma

unread,
Oct 21, 2009, 7:10:23 PM10/21/09
to parc...@googlegroups.com
Dan, that is really awesome and totally the kind of thing I was hoping to see when I 'ported' Gnusto to work on the Web. 

The only thing about 'embedding' Parchment into a page is that I'm not quite sure how it'd work aesthetically and UI-wise--the current UI was pretty much designed to be a fully-immersive experience, i.e. something to fill the whole page and preferably the whole screen.  But embedding a Z-Code game into a page is totally a valid use-case, too... we should see if there's any easy way to tweak the UI to make this possible, e.g. by detecting if Parchment is in an IFRAME and altering the UI as necessary, or perhaps providing an entirely different front-end.

- Atul

Tustin2121

unread,
Nov 21, 2009, 6:50:27 PM11/21/09
to Parchment
Hi, I've been looking at parchment for a little while now, and I've
been looking at this code that DanMonroe posted very recently. I
didn't think the code is very robust (which I'm sure Dan would agree
with, given his statement that it isn't release ready) so I redid the
code to make it more practical and robust. The code below is inserted
into parchment.min.js (so the c variable is the self variable):


onPrint: function(output){
var styles = c._calcFinalStyles();

//handle normal output
c._log("print wind: " + c._activeWindow + " output: " + output.quote
() + " style: " + styles);
if (c._activeWindow == 0) {
var lines = output.split("\n");
for (var i = 0; i < lines.length; i++) {
if (lines[i]) {
var chunk = lines[i].entityify();
// Handle hooks
chunk = chunk.replace(/\[parchment:(\w+) ([^\]]+)\]/gi, function
(whole, tag, params){
c._log("found hook: "+whole+" parts:"+tag+", ("+params+")");
if (tag == "img"){ //handler for image
var chunk = '<div class="imageWrap"><img ' + params + "></div>";
return chunk; //replace found string with the img tag
} else if (tag == "span" || tag == "css"){ //handler for css
classes
var chunk = '<span ' + params + '>';
if (spanOpen){chunk = '</span>' + chunk;}
spanOpen = true;
return chunk; //replace found string with the span tag
} else if (tag == "/span" || tag == "endspan" || tag == "/css" ||
tag == "endcss"){
spanOpen = false;
return '</span>';
} else { //handler for everything else
if (typeof handleParchmentHooks == 'function'){ //if the
function defined, we don't continue with this case
var functargs = new Array();
params.replace(/(\S+)=\"([^\"]+)\"/g, function(w, k, v)
{functargs[k] = v; return "";}); //pull " quoted params out into
associative array
params.replace(/(\S+)=\'([^\']+)\'/g, function(w, k, v)
{functargs[k] = v; return "";}); //pull ' quoted params out into
associative array
params.replace(/(\S+)=(\S+)/g, function(w, k, v){functargs[k] =
v; return "";}); //pull unquoted params out into associative array
params.replace(/(\S+)/g, function(w, k){functargs[k] = true;
return "";});//pull declaritive params out into associative array
if (params.replace(/ /g, "").length != 0){
c._log("not all params read: some hook parameters may have
been malformed.");//(params must be in forms x=\"a b c\", x='a b c',
x=a, or x.)
}
var chunk = handleParchmentHooks(tag, functargs); //call a
function that should be defined by the user
if (chunk){return chunk;} //if something was returned (ie not
null, "", 0, or false), replace with that
else {return "";}
} else {
c._log("hook handler is undefined.");
return "";
}
}
});

// TODO: This isn't an ideal solution for having breaking
// whitespace while preserving its structure, but it
// deals with the most common case.
chunk = chunk.replace(/(\S) (\S)/g, "$1<&>$2" ); //single space
between words
chunk = chunk.replace(/ /g, '&nbsp;'); //single space
chunk = chunk.replace(/<&>/g," " ); //back to space (why use the z-
breaking-whitespace class? removed, as it breaks hook tags)
chunk = '<span class="' + styles + '">' + chunk + '</span>';
$("#content").append(chunk);
}
if (i < lines.length - 1)
$("#content").append("<br/>");
}
c._scrollBottomWindow();
} else {
c._console.write(output, styles);
}
},


With this code, when parchment detects a string in the form of
[parchment:XXX YYY] (even if it is embedded inside long outputs, and
even if there's more than one instance of said form in the output), it
will process that string through either its built-in support for
[parchment:img ...], built-in support for [parchment:span ...], or
send it to a user-defined function handleParchmentHooks() which will
do with it what it will. The aforementioned function does not need to
exist for the code to work. I have tested this for img and user
defined functions, and it works. I had to change the "back to space"
replace function so that it simply put a space back instead of the z-
breaking-whitespace span (I don't know what the span is for, but it
seems useless and just unnecessary padding in the html); placing the
span would place it in the middle of created tags, breaking the tags.

I am also working on an extension for Inform to make adding these
[parchment:...] tags easy. Comments? :)

weevil

unread,
Nov 23, 2009, 11:21:17 AM11/23/09
to Parchment
I got very frustrated with a couple of aspects of parchment that have
caused me to look for another interpreter- the first was a lack of
glulx support because my game file is too large to compile to z8 any
more (I always intended to trigger images with javascript instead of
having them inline, regardless of whether there was glulx support or
not, I need the images in a separate div), and the second, and more
important, was the fact that parchment attempts to do styling in
javascript, instead of keeping layout separate in css. Things like
column width that could be done simply with divs are being set in js.

I've been working with a C glulx parser called iffy now.
http://code.google.com/p/iffy/updates/list I was able to get iffy up
and running and easily style it however I like with CSS. Unfortunately
I've been getting some random fatal errors that seem to be originating
from the C code, and there is no way that I can find to contact the
author of that code.

Stuck between a rock and a hard place.

Atul Varma

unread,
Nov 23, 2009, 12:43:43 PM11/23/09
to parc...@googlegroups.com
Oh, the reason I did some of the styling in JS was because there were certain things that I didn't know how to do "statically" through CSS: for instance, I wanted to set the width of the column to be about 80 characters wide of whatever monospaced font was being used.

There might be ways to actually do this through CSS2 that I don't know about (I tried just setting the width to 80em and that didn't seem to do the trick), or there could be cool CSS3 features that allow it all to be defined in a static CSS sheet.  If we change to whatever mechanism this is, then it shouldn't be too hard to modify parchment so that none of its styling is done at the JS level.

Another easier alternative is to add a "hack" in the code that basically says "if an external stylesheet is requested, then don't run any of this funky JS code that dynamically sets css attributes".

Thoughts?  I was a bit of a web newb when I wrote Parchment, as it was sort of my project to get myself up to speed with how the web works today, so there are definitely some poor decisions made in its codebase. :(

- Atul


--

You received this message because you are subscribed to the Google Groups "Parchment" group.
To post to this group, send email to parc...@googlegroups.com.
To unsubscribe from this group, send email to parchment+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/parchment?hl=.



weevil

unread,
Nov 23, 2009, 12:49:12 PM11/23/09
to Parchment
I think Dan Monroe was going in and specifically disabling the column
width being set in js so he could do it in css, which is what I
figured I would do until I started chasing iffy around. I kept an
archive of my parchment version of the game, so I can always return to
it later.
> >http://code.google.com/p/iffy/updates/listI was able to get iffy up
> > and running and easily style it however I like with CSS. Unfortunately
> > I've been getting some random fatal errors that seem to be originating
> > from the C code, and there is no way that I can find to contact the
> > author of that code.
>
> > Stuck between a rock and a hard place.
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "Parchment" group.
> > To post to this group, send email to parc...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > parchment+...@googlegroups.com<parchment%2Bunsubscribe@googlegroups .com>
> > .

Atul Varma

unread,
Nov 23, 2009, 12:53:46 PM11/23/09
to parc...@googlegroups.com
Oh, ok.  So at the very least, it sounds like some sort of configuration option should be able to be passed to Parchment such that it can just disable these "hacks" that it needs for its default UI to work.

Would either you or Dan be interested in submitting a patch that allows for this kind of thing?  Ideally I'd think that folks should be able to customize Parchment the way you guys are doing without having to change its source code...

I wish I had more time to spend on this project.

To unsubscribe from this group, send email to parchment+...@googlegroups.com.

Dannii

unread,
Nov 26, 2009, 9:32:54 PM11/26/09
to Parchment
On Nov 22, 9:50 am, Tustin2121 <tustin2...@gmail.com> wrote:
> I am also working on an extension for Inform to make adding these
> [parchment:...]  tags easy. Comments? :)

I love all that you're doing, but I'm not sure about a public
extension. If you do make one, please make it clear that this is a
very hacky and non-ideal situation. Actually... a public extension
does have a big advantage, which is that people could start using it
and could then give comments on what functionality and syntax they
wish it would provide.

It would be great if it would still work without Parchment, but to do
that we need to detect whether the game is being run by Parchment. I
had an idea about using the check_unicode opcode to test for
parchment... by setting an extra bit that will normally not be set,
but also should be ignored. If that is robust we could add this to the
standard Parchment.

The ideal future would have some kind of similar situation, but with a
new IO system for Glulx. Then we don't have to hack it at all, it
would be neat and clean.

weevil

unread,
Nov 30, 2009, 1:19:44 AM11/30/09
to Parchment
I got my game working with Iffy, but it is still lacking some stuff
that is much more elegant in parchment.

For one thing, there's no auto (more...) prompt if too much text rolls
by. I was hoping I could set a variable with a number of lines and
force a 'hit any key' if it rolled past that. no go. Does Parchment do
that automatically? Is it adjustable, or is it set somewhere in the
javascript in a non-editable way?

Also, Parchment has classes for its text styles, which is great for
changing stuff in CSS, Iffy has inline styles with no class names. I
was hoping for a while I could inject a jQuery animate that would
reveal the text letter by letter (quickly) to help with the problem of
a ton of text just popping on (at least this way the player would see
it rolling past), but without any classes or id's in there (the div
that iffy puts all the console text in is unnamed even) there's not
much I can do.

How does parchment handle saves? The Iffy save architecture is pretty
much useless.

Despite its rough edges, Iffy was very simple to set up and super easy
to style. I'd like to give parchment another go at some point though.

Tustin2121

unread,
Dec 4, 2009, 5:42:27 PM12/4/09
to Parchment
When I use parchment on my machine, if too much text prints, parchment
will simply scroll to the top of the new text, allowing you to scroll
down to the prompt on your own. It's not (more...), but it is similar
functionality (and I personally like it more).

Parchment currently saves to the URL - that is, when the save command
appears, parchment changes the hash in the URL to a base64 string
which (I assume) is the encoded machine state (since that's how z-
machine saves: with machine states). The saved-game URL is
exceptionally long, so things like Google Bookmarks which cut off the
URL at a limit point won't properly save it, however browser bookmarks
seem to work fine. And when you refresh or come back to the page with
that bookmark, the game will pick up like you left off, like the z-
machine is supposed to do. According to the project page, this isn't
ideal and may change eventually, but it's the best that can be done
now.

Here's an example of a save game URL:

http://parchment.googlecode.com/svn/trunk/parchment.html?story=http://parchment.toolness.com/if-archive/games/zcode/schooldays.z5.js#Rk9STQAADDJJRlpTSUZoZAAAAA0AAzA5MjgwMHbyARD8AENNZW0AAAtzAB8ZUAAPAQD/ACCCgAD/ADCAAA8BMQACmAAeiAAEFAAAkAAA5wAQCgAG7wAECAAGoQBBATEAABQAjAYABwE1AAArAAQIAAMBNQAABgD/AP8A/wAUCgAEFwACZgAQCAAEcwAAfgAECAAEcwAADAAECAAEcwAADgAECAAEcwAAAgAECAAEcwAAbgAEiAAEFAEcAABsAAIIAARrAABrAAQIAAQXAACqAAQIAAQXAAAaAASIAAQUAABrABSAAERAACAEABICAABAAAZ7AAIIAABAAAKqAAD8AAQIAABAAAJtAADgAAQIAABAAAKqAAYIAABAAAKqAAYIAABAAAKqAAABAAQIAABAAAKqAAD8AAQIAABAAAKqAAYIAABAAAKqAAYIAABAAAKqAADRAAQCAABAAAaFAAIIAAAgAAKQAACGAAZAAAKTAACKAAQCAABAAAaJABAIAAAgAAKTAAAPAAZAAAKQAACMAAQCAABAAAaMAARAAAKcAACOAAQCAABAAAaOAARAAAKaAACRAAQCAABAAAaQAAIIAAAgAAKbAAAYAAZAAAKYAAhAAAKYAAhAAAKYAAhAAAKYAAhAAAKYAAhAAAKYAAhAAAKYAABqAAQIAAAgAAJlAAB5ADBAAAadAAIIAASLAAD4AARMAAFAAAGIAAAXABRAAAahAAIIAABAAAK3AABpAAQKAAZyAAaAAAoIAAbEAAaAABqAAAxAAAQBABIIAABAAAKwAAAtACBEADiAAAoSAAa8AAy1ABiyABaAAAqAAABAAAyAABK7AAQIAAQEAAC+AAy/AAaAAAYFAAp/AAq9AAAJABSAAAxAAAyAAAxAABgCAABAAAbHAAIIAATRAABtAAaAAAoCAABAAAbKAAIIAATJAADHAAQCAABAABgCAABAAAbOAAIIAATaAADHAAZAAAyAAAaqAAKAAAyAAABAAAyAAHpAAAxAAACAAFjkAASIAABAAAIyAAADAAQIAABAAALJARsACu8AAPAAbqgABoAABhQABEAABAMABAIABO8AABYABkAADEAACgIAAEAABPgAAPUAAggABOMAAA4ABAgABPQAAPcABAgABOMAAHwABAgABPgAAM4ABoAADUAAJYAACP4AAogABOoAAPcA/wBpARkABBIABPkAAPoABoAABQEbAAIIAABAAAEBDgAAAQAECAAAQAABAQ4BgwAAKwACCAAAQAABAQ4ABggAAEAAAQEOAAYIAABAAAEBDgAAbwAGgAAFASEABwEgAAYSAA6AABiAAABAAAyAAAUBJwACgAADASYBKAAJASYACIAADIAABQErAARAAAEBKgAIgAAMgAAFAZUABIAAEwEwAARAAAIeAAAfAAaAAAUBMAAMAQAVATIA4QFFAAcBRADvAZUAGQFZAAcBWABFAWAAFwFcAP8A/wDkewD/AP8Aa24A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AAQBAP8A/wD/AKsXAAUBAP8ASHUAA44AAwMACAMAAwQAAwIAAwEADwEAAwEAAxIAAwQAA1QAA0YA/wC8VQAHAfQA/wD/AAZQAMsBAAMBAAUDAAsDaQAAbgEnAAAOAAAhAZ4BAAECAAMB5fyWAAQKAAoUAAMBMQExAAADAAEBMQrYAAQCAAIDAAAXAAQLAAAGM/cAAAEAAgQAChUAABMAAf//AAJnAAABAAAUATEAAAEACgIACAEAAAEAAAEAAAEAAAEAC24fAAIEAAH//wAAAQAAAgAEDwAKCAAAZAADD/8ABAEAA/////8AEgEAAgEAAAEKYAAAAgAAAZu8AAABAAQEAAX/ev86/y7/ev86/y4AuAQAABYAABZksQAAAwACBIDRgZWBXoGWgXqAsoDoAAGBPIFJACwEACCaAACbAACXAACWAACVAACUAACTAACSAACRAACOAACMAACKAACGAACqAABtAADHAADOAAD4AAD1AAAZAABmAACdAAB8AAD3AAD+ARwAAGsAAG8BHwEeAR0BGwAA5QAAmwA6IwAAAgEZAADlABn///////////////8AAP3//wAv////////////////AAD9//8ALgEAAAEAAAEAAAEAAAEAAAEAAAEAAAEAAAEAAAEAAAEAAAEAAAEAAAEAAAEAAAEAAAEAAAEAAAEAAAEAAAEAAAEAAAEAAAEAAAEAAAEAAAEAAAEAAAEAAAEAAAEAAAEAAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8BAQEBAQEBAQEBAQEB/wEBAQEEAQEBAQEBAQEBAQEEAwEBAQEB////////////BAP//////////////////////////////////////////////////////////////////////////wAAZAAAZwAAaAAAaQAAoQAAGgAAmAAAmgAAmwAAkAAAiQAAAgMEBQYHCAkKCwwNDgIBAgMEBQYHCAkKCwwNDg8QERERERISEhMUFRYFBQUXAAIBAQICAgAAGwAAHAAAHQAAHgAAHwAAIP/fAAAi/90AACEAACEAACEAACMAACMAACMAACT/2wAAJgAAJ//YAAAoAAAoAAAo/9cAACkAACkAACoAABYAABYAABYAACsAACwAAC0AAC4AAC8AACgAACUN8w34CmAONA40CmAKYApgCmAKYApgCmAKYApgCmAONA40DjQONA40DjQONA40DjQONA40DjQONA40DjQONA40DjQONA40DjQONA40DjQONA40DjQONA40DjQONApgCmAKYA40CmAKYApgCkwKTApMCkwKTApMCmAKTApMCmAKYHgEc2F2ZQAAYWxsAABpbgAAIGdhdGVzAAAga2V5IGluIGJhZwABICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAAAA8Bm7wEAniUAweMlQIMiVkFD3ezARCZjgMSjdkDFoyVAhp6KQMdABp4BXdhdGVyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAAAA8Bp54FAp8KBQcANngEc2F2ZQAAYWxsAABpbgAAIGdhdGVzAAAga2V5IGluIGJhZwABICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAAAHgBdQAAa2UgYWxsAABpbgAAIGdhdGVzAAAga2V5IGluIGJhZwABICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgAB3/egAD/zoAA/8uAAP+zwD/AAQMdGlja2V0IGdhdGVzbGVldmVkIHNoaXJ0dG5vbSBhIHNpZGV3YWxrAP8A/wBWHgAdAFN0a3MAAACUAAAAAAAAAAAAqboA/wAAAACpxR8AAwAAABYASQAAAAAAAAAAAAAAAFUIAAAAAAAAAAAAAgAAAgKFBAsAAAAAAAAhACIA5QDzQB8APwAAABYASwAEAAAAAAAAAAAAAFUSAAQAAAAAAAAAAgAAAgLLBwsPAAAABAAAAAAAAAAEAAAAAAD1HRAAAAAAAPUxEQAAAAAAAA==

Dannii

unread,
Dec 29, 2009, 11:14:33 PM12/29/09
to Parchment
Tustin, you said you were working on an extension to do all this? Care
to share it?

Tustin2121

unread,
Dec 30, 2009, 10:43:53 PM12/30/09
to Parchment
Yeah, an Inform 7 Extension. Below is the extension, called "Parchment
Interface by Tim Pittman". I'm fairly certain that it's done and it
works, but it's been a month and I was doing other things, like
looking into Inform 6. Anyhow, copy and paste the following into a new
extension in Inform 7:

Parchment Interface by Tim Pittman begins here.

Chapter 1 - Use Option

Use Parchment interface output translates as (- Constant
PARCHMENT_HOOKS; -),

Chapter 2 - Parchment Hooks

Section 2.1 - Misc Tags

To make the parchment tag (s - some text): (-
#ifdef PARCHMENT_HOOKS;
print "[parchment:", (PrintText) {s}, "]";
#endif;
-).

Section 2.2 - Images

[if using the Parchment interface output option]
To show the image of (s - some text) on parchment: (-
#ifdef PARCHMENT_HOOKS;
print "[parchment:img src=~", (PrintText) {s}, "~]^";
#endif;
-).

To show the image of (s - some text) with the attributes (a - some
text): (-
#ifdef PARCHMENT_HOOKS;
print "[parchment:img src=~", (PrintText) {s}, "~ ", (PrintText) {a},
"]^";
#endif;
-),

To show the image of (s - some text) with width (w - a number) and
height (h - a number) on parchment: (-
#ifdef PARCHMENT_HOOKS;
print "[parchment:img src=~", (PrintText) {s}, "~ width=",
(PrintText) {w}, " height=", (PrintText) {h}, "]^";
#endif;
-).
To show the image of (s - some text) with alt text (a - some text) on
parchment: (-
#ifdef PARCHMENT_HOOKS;
print "[parchment:img src=~", (PrintText) {s}, "~ alt=~", (PrintText)
{a}, "~ title=~", (PrintText) {a}, "~]^";
#endif;
-).
To show the image of (s - some text) with class name (c - some text)
on parchment: (-
#ifdef PARCHMENT_HOOKS;
print "[parchment:img src=~", (PrintText) {s}, "~ class=~",
(PrintText) {c}, "~]^";
#endif;
-).

Section 2.3 - Span/Classes

To change to parchment class (s - some text):
(- ParchmentHookSpan({s}); -).

Include (-
[ ParchmentHookSpan name;
#ifdef PARCHMENT_HOOKS;
print "[parchment:span class=", (PrintText) name, "]";
#endif;
];
-).

Parchment Interface ends here.


[Please note that in order for hooks to be printed, you must use the
Parchment interface output Use Option. It's with this that all
parchment hooks can be disabled with a simple commenting out of one
line. This presumes that authors will release a version for Parchment,
separate from normal release (since it takes a few more steps to put
the thing into Parchment anyway)]

Reply all
Reply to author
Forward
0 new messages