How do you center images in Quest?

0 votes
31 views
asked Oct 14 in Authoring by Mareus

I was wondering if anyone knows the code to center images in quest? The way it is currently set up, the immage is automatically set to the left side of the screen. So if you are using small pictures, it looks kind of weird. Is there a simple code to center an image?

Thanks in advance!

1 Answer

0 votes
answered Oct 15 by The Pixie (121 points)

Try this:

msg ("<img src=\"" + GetFileURL("gravestone.png") + "\" style=\"display: block; margin-left: auto; margin-right: auto;\" />")
commented Oct 15 by Mareus (1 point)
Well, when i copy your code I get a broken image in the center. I guess, my next question is how do you put a picture there? Perhaps instead of GetFileURL there is a code to show the picture directly from my hard disk? Thanks in advance for your response.
commented Oct 18 by The Pixie (121 points)
Are you editing online?

If not make sure the image file is in the same folder as your game file.

If you are online, it seems the code editor objects to HTML codes, so it will be a bit more effort. First use the picture command to upload your image. Then add a message command, set it to show an expression, and paste in this:
"<img src=\"" + GetFileURL("gravestone.png") + "\" style=\"display: block; margin-left: auto; margin-right: auto;\" />"
Check it works, you show see the image twice, then you can delete the picture command.

More on displaying images here, but again it assumes you are offline:
http://forum.textadventures.co.uk/viewtopic.php?f=18&t=5566
This site is now closed.
As of 1st November 2015, this site is a read-only archive. For more information see the intfiction forum post

Welcome to IF Answers, a site for questions and answers about Interactive Fiction.

Technical questions about interactive fiction development tools such as Inform, Twine, Quest, QuestKit, Squiffy, Adrift, TADS etc. are all on-topic here.

Non-technical questions about interactive fiction are also on-topic. These questions could be about general IF design, specific games, entering the IF Comp etc.
...