displaying images in inform7 and is music / sound possible?

im writing an adventure aboard the titanic, i have already got an image of the ship at the start but how do i call up other images at later stages ?

im a bit stuck :slight_smile:

example of my code:

Figure of image1 is the file “ship.jpg”

Figure of image2 is the file “deck.jpg”

When play begins:
Display the Figure of image1

now this displays ship.jpg just fine but how do i call up the deck.jpg when the player is on deck?

can i also postiton the jpg or better still have is display on its own with no text?

Also

music / sound effects ? is it possible?

thanks a lot
mike.

For the special effects study and use the “built-in” extensions Basic Screen Effects and Image Centering by Emily Short.
Extensions generally provide you with extra functionality, and including these two, helps you do just what I think you want:

Include Basic Screen Effects by Emily Short. Include Glulx Image Centering by Emily Short. When play begins: clear the screen; display Figure 1 centered; wait for any key.

To display Figure 2 when the player arrives on the deck, you just need to use the display phrase inside a rule that fires when the player arrives on the deck. Inform automatically tries looking as soon as the player enters a new location, so you might display the figure from within a rule for looking. E.g.:

After looking in the Deck: display Figure 2; continue the action.

And, yes, you can use sound, too. See chapter 22 of the documentation (and possibly the extension Multiple Sounds by Massimo Stella, which is not “built-in” but must be downloaded from the Inform 7 website and installed on your computer before use).

Note that, to date, using graphics and sound will make your game not work when played via Parchment/Quixe on the web. For example, here’s Alabaster: iplayif.com/?story=http%3A%2F%2F … ter.gblorb

If you’re using the Gnome Inform 7 IDE, sound blorbification won’t work due to a bug in cBlorb. I’m trying to get some attention on that over at inform7.com/mantis

Not quite. Writing a game that fails to check whether the interpreter supports graphics before displaying them is what causes it to break in that way. The basic Inform library display routines do, I believe, check this properly.

–Erik

thanks guys,

i’ll try that now :slight_smile:

how do i tie in the ship.jpg with the figure1 you put?

Ah, well, “Figure 1” was just a dummy name for a dummy file. You should use the names you yourself have declared for your jpg-files:

When play begins: clear the screen; display the figure of image1 centered; wait for any key. After looking in the Deck: display the figure of image2; continue the action.

I’ve been using the Glulx option on the latest Inform7 release on a Mac to compile my adventure.
It was complaining about not having a startpage and endpage graphics and music, so I added some appropriate files (.jpg and .ogg).
It now compiles fully, but gives “[Sound effect number 5 here.” in the interpreter upon startup.
Should one not be able to make an adventure using Glulx and not use sound/graphics? (Mac doesn’t seem to support them anyway).

By the way, I’m using the following extensions, which could be a source of the problem.

Chapter - Extensions

[Include Multiple Sounds by Massimo Stella]

Include Deluxe Doors by Emily Short
[Automatically includes Locksmith by Emily Short and Plurality by Emily Short.]

Include Measured Liquid by Emily Short
[Automatically includes Plurality by Emily Short.]

Include Modern Conveniences by Emily Short
[Automatically includes Plurality by Emily Short.]

Include Computers by Emily Short
[Automatically includes Plurality by Emily Short.]

Include Exit Lister by Eric Eve
[Automatically includes Basic Screen Effects by Emily Short.]

Include StartEnd MenuPages by ShadowChaser
[Automatically includes Menus by Emily Short, Basic Screen Effects by Emily Short, and Useful Functions by ShadowChaser.]

Haven’t been using Inform7 that long, so would appreciate someone pointing me in the right direction.

From the StartEnd MenuPages documenation:

It would seem that ShadowChaser has written this extension such it does indeed require graphics and sound (under Glulx).

Your choices are either to stop using this extension, or edit the extension to remove these particular pieces of code.

Thanks for confirming what I thought.

I’m still feeling my way through getting back into Inform. The last time I used it, there was no nice IDE. Now there’s that and GLULX to boot!

Re: “”[Sound effect number 5 here.]"

This message appears in an interpreter which does not support sound when a sound would normally be played. The Mac IDE can’t play back any sounds - and neither can standalone Zoom (which is basically the same code used in the Mac IDE). But if you run the same game in Gargoyle, which supports sound, you’ll hear them. So you can make a game with sounds in the Mac IDE, you just can’t hear those sounds in the Mac IDE.

Re: Image Centering

I think the extension Glulx Image Centering has been broken for a long time (IE it just doesn’t work)? Let me know if you find I’m wrong. But if it is broken, there is no really “cheap” way to centre an image in glulx. You’d need to use a more substantial extension to do so, like Glimmr something, or perhaps Flexible Windows?.. anyway, my casual advice is don’t worry about image centering 'til further down the track. Image control beyond the most basic kind (slap an image on the screen, aligned left) is hard to do without stepping up to one of the more sophisticated extensions, since players have their windows in all different shapes and sizes, and on top of that, different interpreters react to size mismatches in different ways (EG some scale the image to fit, others display at a fixed size and just let the too-big parts go off the screen, etc.)

Re: StartEnd MenuPages… this extension is designed to include sound and graphics in a glulx game by default. If you want its menu features alone, you will indeed have to chop out the lines which define the title pages and the sounds, and the lines which display/play them.

The only extension which does a similar thing is the one StartEnd was based on, Jon Ingold’s ‘Title Page’, and under Glulx, it also wants a title page by default (but no sounds.)

  • Wade

Glulx Image Centering is built into Inform 7 and works correctly, as far as I am aware - I can’t see any bug reports about it, and a quick test appears to confirm that it has no obvious problems.

I just tried it myself and you’re right. Well, that’s good news for all of us. I can’t remember how and when I decided it didn’t work, but it was a ways ago. Presumably I’ve just been suffering with stupid, non-centred images ever since.

  • Wade

Gargoyle unfortunately doesn’t support centred images in text windows. (Or centred text for that matter.) It can do centred images in graphics windows, but that’s a whole lot more work.

THAT’S where I got the idea from! So there is something that Gargoyle doesn’t do… unless it’s not doing it because it’s staying on spec and everyone else is cheating.

  • Wade

Nope, it’s letting us down. You also can’t change font size, margins etc.

That said, I still think it’s the best interpreter we have!

The guess about my using a Mac is correct.
While I can’t use the built-in interpreter of the IDE to hear the sounds, is there a hosting site that will play them on the net?
My goal is to make the adventures available by storing them on dropbox and providing a link to play them from a web-based interpreter.
Perhaps there is a site that runs gargoyle???

Unfortunately Gargoyle can’t be run online.

As far as I know Vorple is the only thing that can show images and play sounds online for Inform-based games.

Zifmia can do it, but I’ve never put a public host together for it. It’s on the to do list. Actually, Zifmia can do anything you can do in a browser web application. But it would require front-end web programming skills to develop anything against it.

David C.
www.textfyre.com