images in IF

16 views
Skip to first unread message

mick crane

unread,
Jul 2, 2010, 12:04:52 PM7/2/10
to parc...@googlegroups.com
I tried inform7 today but I can't yet get images in there with gluxl.
Copying from the docs I try things like.

"include Location Images by Emily Short.
Figure of Mona is the file "monalisa.png".
Gallery is a room. The room illustration is Figure of Mona.
Rule for starting the virtual machine:
now the current graphics drawing rule is the standard placement rule.
The graphics window pixel count is 378.
Carry out looking:
change currently shown picture to the room illustration of the location;
follow the current graphics drawing rule.
garden is a room.
garden is south of Gallery."

I get a black box with no image.
clues appreciated.

cheers

mick
ps
What happened at int-fiction google groups, they seem full of spammers ?

Dannii

unread,
Jul 2, 2010, 12:21:49 PM7/2/10
to Parchment
Yeah Google doesn't filter out the spam very well... surprising seeing
how good they are with it for gmail.

You should try the intfiction.org forum: http://www.intfiction.org/forum/index.php

mick crane

unread,
Jul 4, 2010, 7:41:10 AM7/4/10
to Parchment


On Jul 2, 5:21 pm, Dannii <curiousdan...@gmail.com> wrote:
> Yeah Google doesn't filter out the spam very well... surprising seeing
> how good they are with it for gmail.
>
> You should try the intfiction.org forum:http://www.intfiction.org/forum/index.php

I had the old version of Emily Short's extension.

I'm now trying to use the extension
Parchment Interface by Tim Pittman

What is the syntax ?

the Gallery is a room.
mona is a thing in the Gallery.
Instead of examining mona:
?

I have put the previously posted code

From: Tustin2121 <tustin2...@gmail.com>
Date: Sat, 21 Nov 2009 15:50:27 -0800 (PST)
Local: Sun, Nov 22 2009 12:50 am
Subject: Re: Images in parchment? With or without Glulx...

in parchment.min.js

cheers

mick

Dannii

unread,
Jul 4, 2010, 11:51:00 AM7/4/10
to Parchment
Please ask on RAIF or the int fic forum, or ask Tim himself. I have
never used his extension.

Tustin2121

unread,
Jul 5, 2010, 1:52:36 PM7/5/10
to Parchment
Hm... I'm not sure if my code will work any longer. It seems that they
have completely rebuilt parchment from the ground up to use jquery
since I last edited the thing, and I can no longer find the onPrint
function I was replacing to make the parchment hooks thing work.

So, unless you want to use the old parchment code that I have here on
my machine, I can't really help you any more....... :/

Tim

Tustin2121

unread,
Jul 5, 2010, 2:03:43 PM7/5/10
to Parchment
Wait! I take that back. The function I was looking for has since been
moved to zmachine.min.js (or zui.js). I will post in a moment about
how my extension works.

In order for it to work, though, the following code needs to be
inserted after line 840: var chunk = lines[i].entityify();
I don't know if it's possible for me to do it, or if danni has to do
it. Or, who ever wants to use hooks will just have to modify the min
file themselves.

<code to be inserted>
// 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>";
/*while((args = /(\S+)=(\S)/.exec(params)) != null){ //pull params
out
chunk.append(args[1] + '="' + args[2] + '"');
}*/
//chunk.append();
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;}
/*while((args = /(\S+)=(\S)/.exec(params)) != null){ //pull params
out
chunk.append(args[1] + '="' + args[2] + '"');
}*/
spanOpen = true;
return chunk; //replace found string with the span tag
} 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){ //pull "
quoted params out into associative array
functargs[k] = v; return "";
});
params.replace(/(\S+)=\'([^\']+)\'/g, function(w, k, v){ //pull '
quoted params out into associative array
functargs[k] = v; return "";
});
params.replace(/(\S+)=(\S+)/g, function(w, k, v){ //pull unquoted
params out into associative array
functargs[k] = v; return "";
});
params.replace(/(\S+)/g, function(w, k){ //pull declaritive params
out into associative array
functargs[k] = true; return "";
});
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 "";
}
}
});
</code to be inserted>

mick crane

unread,
Jul 5, 2010, 2:11:45 PM7/5/10
to parc...@googlegroups.com
On Mon, July 5, 2010 6:52 pm, Tustin2121 wrote:
> Hm... I'm not sure if my code will work any longer. It seems that they
> have completely rebuilt parchment from the ground up to use jquery since I
> last edited the thing, and I can no longer find the onPrint function I was
> replacing to make the parchment hooks thing work.
>
> So, unless you want to use the old parchment code that I have here on
> my machine, I can't really help you any more....... :/
>
> Tim

Hi,
did you get my direct email ?
the guys that are doing this 360VR for the iphone etc are using jquery so
I think there is a possibility that this stuff can be made to work so I
can have my 360VR interacting with IF made with inform7.
the code that Dan posted
[JQ]
is that jquery ?
sorry I'm not very clued up.
I want to get a technical framework together and then play around with the
content.
That said what was/is the syntax in the inform7 code to show an image
using the parchment extension ?

cheers

mick

> On Jul 4, 7:41�am, mick crane <mick.cr...@gmail.com> wrote:
>
>> On Jul 2, 5:21�pm, Dannii <curiousdan...@gmail.com> wrote:
>>
>>
>>> Yeah Google doesn't filter out the spam very well... surprising
>>> seeing how good they are with it for gmail.
>>
>>> You should try the intfiction.org
>>> forum:http://www.intfiction.org/forum/index.php
>>>
>>
>> I had the old version of Emily Short's extension.
>>
>>
>> I'm now trying to use the extension
>> Parchment Interface by Tim Pittman
>>
>>
>> What is the syntax ?
>>
>>
>> the Gallery is a room. mona is a thing in the Gallery. Instead of
>> examining mona: ?
>>
>>
>> I have put the previously posted code
>>
>>
>> From: Tustin2121 <tustin2...@gmail.com>
>> Date: Sat, 21 Nov 2009 15:50:27 -0800 (PST)
>> Local: Sun, Nov 22 2009 12:50 am
>> Subject: Re: Images in parchment? With or without Glulx...
>>
>>
>> �in parchment.min.js
>>
>>
>> cheers
>>
>> mick
>

> --
> You received this message because you're subscribed to the Parchment
> Google Group. http://groups.google.com/group/parchment
>
>
>


Tustin2121

unread,
Jul 5, 2010, 2:13:40 PM7/5/10
to Parchment
The Inform7 extension (here:
http://groups.google.com/group/parchment/browse_thread/thread/f19890f997702dd/dea9f54aa24f197a?lnk=gst&q=extension#b9f9c0c7913eb800)
essentially allows Inform7 to print to the output directly the proper
tag. The modified onPrint function, looks for any instances of
[parchment: (...)] and replaces them with proper html tags.

To use the inform7 extension, first you must use the "Parchment
interface output" use option. If you want to build your story for a
non-parchment interpreter, just comment out the use option, and all
output of [parchment: ...] tags will cease without you having to
comment out every instance of it.

Once that use option is in place, you can use the following
statements:

Inserting images:
The following will make parchment insert an <img> tag, with the
following attributes:

-- "show the image of (s - some text) on parchment" (Inserts <img
src=(s) />)
-- "show the image of (s - some text) with the attributes (a - some
text) " (Inserts <img src=(s) (a)/>) *
-- "show the image of (s - some text) with width (w - a number) and
height (h - a number) on parchment" (Inserts <img src=(s) width=(w)
height=(h) />)
-- "show the image of (s - some text) with alt text (a - some text) on
parchment" (Inserts <img src=(s) alt=(a) title=(a) />)
-- "show the image of (s - some text) with class name (c - some text)
on parchment" (Inserts <img src=(s) class=(c) />)

Inserting span tags
-- "change to parchment class (s - some text)" (Inserts <span
class=(s)>)
[There should be a "change back" or something, but there isn't, so
instead you can use the generic below like so: "make the parchment tag
"endspan"".]

Inserting any tag
-- "make the parchment tag (s - some text)"
Prints to the output stream [parchment: (s)] so you can insert any
statement, though you require the proper hook function.

*This one should have an "on parchment" on the end, but I seem to have
forgot it in the definition.

That last statement allows you to insert anything into the parchment
output. All you have to do is know a little javascript. So for
example, lets say I have the statement in inform7 make the parchment
tag "helloworld say='hola'" (notice the similarity to html tags). On
my page where I have the parchment library defined, I would have a
<script> tag under the <script> tag where the parchment library is
defined. It would look something like this:

<script>
function handleParchmentHooks(tag, args){ //the modified onPrint
function looks for a handleParchmentHooks function
if (tag == "helloworld"){ //the first argument holds the name of
the tag
if (args["say"] != null){ //the second argument holds an
associative array of the attributes
return args["say"]; //return a string to insert into the
output on parchment
} else {
return "Hello World!";
}
}
}
</script>

If you have any questions, ask away. I'm sure I didn't do too well at
explaining.

Tustin2121

unread,
Jul 5, 2010, 2:16:32 PM7/5/10
to Parchment
I got your email, and I sent you a better formatted version of my most
recent post. :)

Thanks,
Tustin2121

Tustin2121

unread,
Jul 5, 2010, 2:26:50 PM7/5/10
to Parchment
I gave you the wrong code to insert into the trunk of the project. I'm
not sure if spans would work properly, actually, now that I look at
the code. I've never thoroughly tested them. So disregard the section
that works with spans and css.....

Tustin2121 / Tim
(whichever sig I choose to use at the moment...)

On Jul 5, 2:03 pm, Tustin2121 <tustin2...@gmail.com> wrote:

Dannii

unread,
Jul 5, 2010, 5:59:52 PM7/5/10
to Parchment
Because it's now using a nice class system it would probably be
easiest to just sub-class ZUI. Can you post (perhaps at a postbin?)
the complete onPrint() with your modifications?) Then I can use it to
give some code to simply add to the end of zmachine.min.js.

Tustin2121

unread,
Jul 6, 2010, 12:28:56 PM7/6/10
to Parchment
I'd be glad to do a subclass, that makes it a lot easier to work
with. :)

Just.... What/where is a postbin?

Tustin2121

unread,
Jul 6, 2010, 12:37:13 PM7/6/10
to Parchment
And where should I subclass to? Something like parchment.lib.hookedZUI
or parchment.lib.ZUI.hooks, or something to that extent?

(PS, I'd LOVE if Google Groups had an edit button.... they don't seem
to support that functionality though....)

Dannii

unread,
Jul 7, 2010, 8:57:01 AM7/7/10
to Parchment
I would do:

tempzui = parchment.lib.ZUI;
parchment.lib.ZUI = tempzui.subClass({
onPrint: function() {}
});

That way the rest of parchment wouldn't need to be changed. :)

Tustin2121

unread,
Jul 8, 2010, 10:46:42 AM7/8/10
to Parchment
Ok, so there seems to be an error with Parchment. parchment.lib.ZUI is
undefined, and without that there is no Parchment and no subclass... :
(

Tustin2121

Tustin2121

unread,
Jul 8, 2010, 11:05:00 AM7/8/10
to Parchment
Stepping through the code, it seems that "stage2" is never run to
initialize the ZUI, and is zmachine.min.js (or zui.js in the full
version) ever looked at? I've never been this deep in javascript
before to know what on earth is going on. All I know is that parchment
isn't running.....

Dannii

unread,
Jul 8, 2010, 11:34:54 AM7/8/10
to Parchment
I don't have the time to look at this right now sorry, giving a
conference presentation tomorrow. I'll try to take a good look at it
when I get the chance!

mick crane

unread,
Jul 15, 2010, 4:08:01 AM7/15/10
to parc...@googlegroups.com

On Thu, July 8, 2010 4:34 pm, Dannii wrote:
> I don't have the time to look at this right now sorry, giving a
> conference presentation tomorrow. I'll try to take a good look at it when I
> get the chance!

Any idea when play restarts ?

cheers

mick

DanMonroe

unread,
Jul 15, 2010, 2:16:15 PM7/15/10
to Parchment
No, [JQ] is not jQuery. It's simply a character sequence I looked for
in order to perform the special handling. My code is probably no good
anymore since all the updates and plug in. I haven't played with it
since then.

Dan
Reply all
Reply to author
Forward
0 new messages