ID:161278
 
Okay, here's the situation. I have an XML file that contains a reference to a file. When the program starts, it reads that file name and converts it into a file(), then assigns it to a datum as a variable. That variable is then read and assigned to an interface label's image parameter.

So essentially it goes like this:

// Check to see if the value is a file and directory.
if(findtext(xml_var, ".png"))
xml_var = file("/gfx/[xml_var]")

datum.image = xml_var

winset(player, "window.label", "image='[datum.image]'")


(That's made up code which represents what I'm actually doing.)

However, in the end, the label's image doesn't change any. However, I can do a direct reference to the image from the RSC to the label, and it'll work just fine:

winset(player, "window.label", "image='['image.png']'")


Don't really know what I'm doing wrong at the moment. Any help?
Well, my first thought was that the file wasn't being included in the .rsc, as it was never directly referenced. However, I think file() would take care of that. One thing I can suggest is to try using browse_rsc() to send the client the file before changing the image. If that doesn't work, try some debugging. Another possible problem is that winset() isn't expecting a file reference, but a filename (which could be solved with browse_rsc()).

Arg, but again, if you switch to using browse_rsc(), you have to have some kind of reference to your file or it won't be included.
In response to DarkCampainger
I still don't know what the problem is, but I'm pretty confident that it isn't something that would require browse_rsc(), since the only real reason why I'd need to send an image to the cache is so the browser can read it. Besides, I want to avoid sending things to the cache if I can avoid it.

I did something similar loading images from a text file reference, but using savefile Import/Export stuff instead of XML files. It shouldn't make much of a difference, but this setup also has the directories arranged a little funny... I really just have no idea what the problem is at the moment.
In response to Foomer
I think the bottom line to the question is, how do I get a file()ed PNG to show up properly, like this:

src << "IMG: <img src='[file("myimage.png")]'>"


Since that evidently won't work. Even if this will:

src << "IMG: <img src='['myimage.png']'>"