ID:160070
 
Is it possible to winset an image to a label? If it is, could someone show me how?

If it isn't, some advice would be pretty cool. Here's what i'm trying to do: I have a skillcard with various information(using outputs, etc.) and one of them is supposed to be the avatar(the label, tried output).

Thanks for the help..
The skin reference is your friend.

Labels have an 'image' parameter.

Ex:

winset(client, label_tag, "image='my_file.png'")
In response to Alathon
oh wow, thanks! This will make things so much easier for me, especially since there are a lot of avatars.

I was working on this:
In response to Axerob
You should call it the Ninja Info Card :P
In response to Alathon
How would you set the user's icon+overlays to a label?

winset(src,"ID","image=src")

Like that?
In response to Mizukouken Ketsu
No, because src is a mob, not an image. You would have to create one big image from their overlays and their icon with icon.Blend() and its ICON_OVERLAY/ICON_UNDERLAY function(s).
In response to Jeff8500
var/image/I = image(src)
winset(src,"Label","image=[I]")


I HIGHLY doubt that'd work, but it couldn't hurt to ask if it will. xD

If it doesn't could you give me a couple leads as to how I would do this?
In response to Mizukouken Ketsu
Look up the mob/icon var >_<

proc/Fuse_Icons(mob/M)
var/icon/I = new(M.icon)
for(var/atom/X in M.overlays) //these are considered atoms, correct?
I.Blend(X.icon,ICON_OVERLAY)
return I


If they aren't considered atoms, you may need to use the : operator (or type cast them as whatever overlays are considered to be ancestors of, I'm not sure what BYOND thinks of their ancestry).
In response to Jeff8500
They are a special type not documented. Lummox once said it's name. I can't actually remember it right now.

You need to use the : operator since there's no other way, I think.

Edit- [link], Found it.
In response to Andre-g1
proc/Fuse_Icons(mob/M)
var/icon/I = new(M.icon)
for(var/X in M.overlays) //these are considered atoms, correct?
I.Blend(X:icon,ICON_OVERLAY)
return I
In response to Jeff8500
You should use a typecast variable instead of the : operator.

proc/Fuse_Icons(mob/M)
var/icon/I = new(M.icon)
for(var/X in M.overlays)
var/atom/A = X // treats X as if it were an atom
I.Blend(A.icon,ICON_OVERLAY) // now use A.var instead of X:var
return I
In response to Xooxer
Okay it's only showing the text "/icon" in the label box. :\

//Xooxer's code
proc/Fuse_Icons(mob/M)
var/icon/I = new(M.icon)
for(var/X in M.overlays)
var/atom/A = X
I.Blend(A.icon,ICON_OVERLAY)
return I

//I want the preview to show the updated icon when the following verb is used
mob/Logging/verb
Skin_Color_Select()
set hidden = 1
if(!src.Gender)
src<<output("Please select a gender first!","World")
return
src.icon = file("[Gender]Base[Num2Tone(Skin_Tone())].dmi")
winset(src,"Preview","text=[Fuse_Icons(src)]")
In response to Mizukouken Ketsu
I think you need the \ref text macro before the icon reference. And, um. You're setting the text, what did you expect it to output?

winset(src,"Preview","image=\ref[Fuse_Icons(src)]")
In response to Xooxer
WOW! lol I'm so blonde x.x Thanks Xooxer!

EDIT
Now nothing is appearing at all :\
In response to Mizukouken Ketsu
Ah, right. This one is a bit trickier than that. You'll need to use fcopy_rsc() on that icon:

mob/Logging/verb
Skin_Color_Select()
set hidden = 1
if(!src.Gender)
src<<output("Please select a gender first!","World")
return
src.icon = file("[Gender]Base[Num2Tone(Skin_Tone())].dmi")
var/icon/I = Fuse_Icons(src)
winset(src,"Preview","image=\ref[fcopy_rsc(I)]")
In response to Xooxer
Now we're getting somewhere :) Unfortunately, I want only the current icon state, including any overlays added to the icon. What the label now shows me, I think, is every icon state the icon has in it's .dmi file.

EDIT
I'm going to specifiy what I want out of this little learning session for clarity reasons. I have a verb assigned to a pushbox button that gives the user an icon. I want that icon's CURRENT state only, to appear in the label element.

Next step. I also have a different verb assigned to a different pushbox button that gives the user hair. I want that hair overlay ADDED to the preview (again current icon state only).

Hope that clarifies :D
In response to Mizukouken Ketsu
Ah, you want to change the line in your Fuse proc to:

var/icon/I = new(M.icon, M.icon_state)


You could also account for current dir there too.
In response to Xooxer
It's still showing more than one icon state. Do I have to create a "still" icon state in the .dmi file rather than just keeping the movement icon state?

And it isn't including any overlays >.< Even when I added...
    var/icon/I = new(M.icon, M.icon_state, M.dir, M.overlays)
In response to Mizukouken Ketsu
Which is because icon() and new /icon don't have a fourth arg for overlays...
In response to Mizukouken Ketsu
Hrm, so it seems you can't typecast from overlys. :/

proc/Fuse_Icons(mob/M)
var/icon/I = new(M.icon, M.icon_state, M.dir, 1)
for(var/X in M.overlays)
var/icon/A = new(X:icon, X:icon_state, X:dir, 1)
I.Blend(A, ICON_OVERLAY)
return I
Page: 1 2