ID:154737
 
I wanna add the icon of an obj to a label...

Example:

I have a image.dmi file
I have a list called list2
and a label called label2

This is what I'm doing:

var/obj/x = usr.list2[1] //get the first obj from the list
winset(usr,"default.label20","image=[x.icon]") //change the icon for the object icon which is image.dmi...

This works, but there is a problem:

The file called image.dmi has 50 images, each one separeted by a icon_state. How can I specify the icon_state that I want?

var/icon/I=new(icon,icon_state)
var/IconPreview=fcopy_rsc(I)
winset(src,"Preview","image=\ref[IconPreview]"
In response to Kaigne
Thanks, but there is another problem...

How can I use Click() in a label? ( i dont want to make buttons, just wanna usa it like a grid )

the size is 24x32 thats why i cant use a grid, because i wanna fit the obj icon in that label.

If it is impossible, can I make and obj invisible to some people but visible to others?
In response to Muvuca
Muvuca wrote:
Thanks, but there is another problem...

How can I use Click() in a label? ( i dont want to make buttons, just wanna usa it like a grid )

the size is 24x32 thats why i cant use a grid, because i wanna fit the obj icon in that label.

If it is impossible, can I make and obj invisible to some people but visible to others?

You can not use any Mouse Functions when it comes down to labels, you CAN RESIZE THE LABEL to the specified size. If you really need to add Click(), I suggest using the grid element in the skin file. I don't know much about using grids (looks terrible to me) but it is an alternative. OR!! You can try another approach by using the HUD.
In response to Kaigne
Ok, so... How can I make an obj be invisible to some people but visible to others?
In response to Muvuca
If your talking about the HUD alternative then it would be something like..
obj/HUD
Something
icon='Something.dmi'
screen_loc="5,5"

mob/var/obj/HUD/Something=new/obj/HUD/Something //An easy way to keep track of the object through a var

mob/proc/AddHud()
src.client.screen+=Something


You can also toggle the visibility by
Something.invisibility=1 //1 to hide it 0 to show it
In response to Kaigne
This way only the player can see the obj?

If yes, that is exactly what I want.
In response to Muvuca
Yes adding objects to a clients screen only allows them to see it.
In response to Kaigne
Thanks, it works!

Now I have one question...

How can I change the pixel_x or pixel_y of the object in screen?

I tried to do as normal and did'nt work.

EDIT: NVM, I found it.


Thanks for help.