I’m trying to insert a jpg inside a description of an object. Is that possible?
Yes, here’s one way to do it:
The Museum is a room. Figure of Foobar is the file "Foobar.jpg". The painting is in the Museum. Carry out examining the painting: say "It depicts a faraway planet."; display the Figure of Foobar; say "What a fascinating landscape!"; stop the action.
It keeps telling me that it can’t find a verb that it recognizes.
This is what I had written:
The brown paper is part of the wall.
Carry out examining the brown paper:
say “You find seemingly random selections of text and illustrations from the Exodus story as recounted in Hebrew’s scripture.”
the Figure of Exodus is the file “exodus1.png”.
Display the Figure of Exodus.
Stop the action.
I’m no expert at images, but I don’t think you’re allowed to declare them within a rule like that (from what you posted I’m also not sure if you’re using semicolons in your rules?) This should work:
Figure of Exodus is the file “exodus1.png”. The brown paper is part of the wall. Carry out examining the brown paper: say “You find seemingly random selections of text and illustrations from the Exodus story as recounted in Hebrew’s scripture.”; Display the Figure of Exodus; Stop the action.
(By the way, you can use the preformatted text tool – the one that looks like </> in the toolbar above – to paste in your code in a more readable way).
Hope this is helpful!
Thanks again for trying to help me.
Your code worked…kind of. The figure ended up showing as the red stop sign with the exclamation point. So I must’ve done something wrong with the image file on my end.!
Ugh, sorry, it worked when I tested it! Only thing I can think of is maybe there’s case sensitivity, like try renaming the folder “Figures”? If that’s not it, can you paste in your actual code so I (or more likely, someone who knows this stuff better) can take a look?
Thanks for attempting to help me.
So I was reading about Glulx. Is that something I need to download to see the images possibly? I have a mac OS Mojave.
This seems to be working for me. I had to make the image small enough to fit in the window for it to show up, though.
Figure of Exodus is the file “exodus.png”. A wall is in a room. The brown paper is part of the wall. Carry out examining the brown paper: say “You find seemingly random selections of text and illustrations from the Exodus story as recounted in Hebrew’s scripture.”; display the Figure of Exodus; stop the action.
Glulx isn’t a separate thing you need to download – it’s an underlying file format that your story will be released in. Or, rather, it’s one of two possible options – the other is .z8, for the Z-machine. In a sort of very general way, choosing between Glulx and the Z-machine is something like choosing whether to save an image you’ve created as JPEG or PNG. Each has its strengths and weaknesses, and each is better suited to certain applications.
All of the image-handling (and sound-handling) that Inform can do is really only available if your story is being created as a Glulx file, though. (It’s possible in theory to include images and sounds in Z-machine games but Inform 7 doesn’t support that at all, at least not out of the box.) Really, these days, you should be creating a Glulx project unless you already have a specific reason for wanting to use the Z-machine.
Chances are, if you haven’t monkeyed around with the settings, your project that you’re working on is already set up to use the Glulx format. You can check by going to the “Settings” tab in the Inform IDE and making sure that Glulx is the chosen format. If it isn’t, you should select it, because graphics will almost certainly not work if you don’t.
So possibly I put the image files in the wrong location? Do I need to designate where they are or will it find the file called ‘figures’ on it’s own?
From you screenshot, it looks like the image files are in the right location, a figures folder inside a .materials folder. It should work, so the problem must lie elsewhere.
EDIT: At first I thought it might be a format problem, as there is some confusion in this thread whether the image is a JPEG or a PNG. But in fact that doesn’t matter to Inform, at least not on macOS. I tried renaming my PNG file exodus.jpg in both the Finder and in the source code, and the IDE would still show the cat picture correctly. This is likely to cause problems on other interpreters, though.