ID:1848902
 
(See the best response by Super Saiyan X.)
Code:
obj/QuestItems
var/icon/I = icon('Something.dmi',icon_state="Somethingalse")
Test
Click()

winset(usr,"QuestBook.QuestDetails","image=\"[src.I]\"")


Problem description:
The image does not display. Any help appriciated

Well, not that i have much to go on, but in the Skin Params doc it suggests the format is image='[File]', so i would think this means you're meant to pass only the icon file (dmi in this instance), and as such that it be encased in single quotes, so perhaps that's your issue... assuming that your icon info is correctly defined ("Sometingalse?" is that correct?).

Edit: Yeah, i tried a number of ways, i don't image will accept anything beyond a simple file definition there, so the icon_state bit of your variable will stop the image from showing, not yet thought of a way that might let you show images based on states from a file with multiple images inside.

Best response
Try:
"image=\ref[fcopy_rsc(src.I)]"
In response to Super Saiyan X
Hmm, it'd be good if you explained why that works for interested parties, nevertheless it works all the same, so thanks (saves me from spending more time trying to achieve that result, gratzie :D).
fcopy_rsc copies the icon into the game's global resource cache, rather than just being cached for the user it's appearing to.
\ref creates a string reference to the icon (something like0x0123abcd) which is a direct pointer to that icon, similar to using icons in HTML or outputs.
Thanks it helped :D
Firstly, thanks for the explanation.

Secondly, I realised i could just check the reference/help stuff to try and understand what each of those did, however even with that and your explanation, i'm not really sure i get /ref beyond the point that it creates a unique id for an embedded object... i mean, that doesn't really seem like it covers exactly everything it does.
Could you further deliberate on it's purpose within the statement you provided? Especially as it seems that statement requires both /ref and fcopy_rsc specifically to work.


(Does /ref only work on icons if they're within the game's cache? what else does it do at the same time as assigning a unique id, i don't see what that provides that makes the image parameter suddenly like the assignment.)
var/icon/I = icon('Something.dmi',icon_state="Somethingalse")


Phat T created an icon object. An icon object is not an icon. It's not anything graphical, just information on how something should be displayed.

var/myicon = fcopy_rsc(I)

fcopy_rsc, in this case, converts/flattens all that information into a graphical icon and stores it into the world's rsc (not the main .rsc, but .dyn.rsc). some icon operations call fcopy_rsc implicitly in the background.

fcopy_rsc returns a reference to that item in the rsc - in this case, the icon you just added to the resource. if you output myicon, you'll just see the icon.

you can use that icon anywhere you want.

winset(usr,"QuestBook.QuestDetails","image=\ref[myicon]")


so, you want to use it in your interface. skin params excepts everything to be text. myicon isn't a string - it's a reference to an icon in the resource cache - so you use the \ref text macro to get the unique id of that icon. every object, file, anything that exists in a DM environment has one. the virtual machine is able to pull that reference using the text ref.

\ref[something] doesn't 'create' the id - it simply evaluates to the unique id of something.

If he hadn't been using an \icon, he should have been just been able to do \ref[I], where I is an icon file, since it'd already be in the resource.
Aaaah, ok alright, i got it. Cheers for the extra explanation, makes somewhat more sense now.

Hmm, so the unique id of something that \ref returns is comparable to a file path?
Actually to clarify this even further, the /icon datum is basically a way of making modifications to an icon in memory before saving it to the cache. As soon as an /icon datum is assigned to an atom's icon var, fcopy_rsc() is done automatically.

Winset accepts cache references for images, and those are used just like filenames. The <img> tag in regular output can handle this too, and there's some trickery in place to make browse() handle it as well--although with browse(), your safest route is always to use browse_rsc() and actually give the icon a filename instead.

The reason fcopy_rsc() has to be done before \ref is that fcopy_rsc() will return a cache reference, whereas the /icon datum is of course a datum. A datum reference isn't all that useful to the client.