How to load pictures using HTML from a computer with no URL links?

Red Knight
19 Jan 2019, 20:34

Does anyone know how to load a picture using HTML code directly from a computer?
Apparently all you need to do is write this into script before entering a room:
<img src='gravestone.png' />

But that doesn't work. All I get is an error:
Failed to load game.
The following errors occurred:
Error: Error adding script attribute 'beforeenter' to element 'Graveyard': Invalid variable name ''

I tried also:
msg ("<img src='gravestone.png' />")

But then I get this:

Any ideas? Been busting my head on this for hours now.

And no, I don't want to use the picture command. I have a specific reason why I need to use HTML. Namely, I want to use the script from this old post:
http://textadventures.co.uk/forum/samples/topic/q5zedoe560au_ii73oamoq/adding-graphics-in-a-specific-location-gui-solved

But in order to load the picture from my computer, I need to use the HTML command. I don't want to use URL links.


mrangel
19 Jan 2019, 20:58

The "msg" version is correct. But it has to be the web address of an image, not just the filename.

If the image is included in your Quest game, you use the function GetFileURL to do that. So it would be:
msg ("<img src=\""+GetFileURL("gravestone.png")+"\" />")


Red Knight
19 Jan 2019, 21:08

Thanks! That worked! Jesus Christ... took me hours to fix it. Now, just one more question. How do you put the picture as shown in the old link above, but so that the order is picture, followed by status, followed by compass and lastly ny inventory?

I found this line:
eval ("$('#pane-pic1').insertBefore($('#inventoryLabel')).show().width('100%');")

and I changed it to:
eval ("$('#pane-pic1').insertBefore($('#statusLabel')).show().width('100%');")

But then the picture disappears...


mrangel
19 Jan 2019, 23:20

There isn't a #statusLabel. I think you probably mean either #statusVarsLabel or #customStatusPane.

The default items in the sidebar are:

  • #inventoryLabel
  • #inventoryAccordion
  • #statusVarsLabel
  • #statusVarsAccordion
  • #placesObjectsLabel
  • #placesObjectsAccordion
  • #commandPane
  • #customStatusPane
  • #compassLabel
  • #compassAccordion

("Accordion" is the object that can be shown and hidden by the player clicking on the matching "Label")


Red Knight
19 Jan 2019, 23:31

Thanks again, mate! It works as intended now!