ID:264031
 
Code:
    Stat()
src.Update()
statpanel("Statistics")
stat("[src.name] Level [src.level]")
stat(src)
stat(" ")
stat("::Physical Statistics::")
stat("Hit Points:", "[src.hp]/[src.maxhp]")
stat("Mana Points:", "[src.mp]/[src.maxmp]")
stat("Strength:", "[src.strength]")
stat("Defense:", "[src.defense]")
stat("Intellect:","[src.intellect]")
stat("Stamina:","[src.stamina]")
stat("Experience:", "[src.exp]/[src.maxexp]")
statpanel("Inventory")
stat("Economic Statistics")
stat("\icon[/obj/statobjects/copper] [src.gil]")

client/New()
..()
spawn winset(src,"Info","allow-html=true")
obj
statobjects
icon='misc.dmi'
copper
icon_state="8"


Problem description:

The icon isn't showing up in the stat panel. I am not using a custome interface, just the default one that comes with DM
I have also tried
statpanel("Inventory")
stat("Economic Statistics")
var/obj/M = new()
M.icon = icon('misc.dmi', "[8]")
stat(M,src.gil)
In response to Plug and Play
Your code in both cases is flawed, but for different reasons. You were kind of on the right track in each case.

stat("\icon[/obj/statobjects/copper] [src.gil]")


With the HTML output enabled, the \icon macro will work, but you're trying to use it on a type path instead of an actual object. The \icon macro doesn't work that way, so this code doesn't produce an image.

I have also tried
var/obj/M = new()
M.icon = icon('misc.dmi', "[8]")
stat(M,src.gil)


Again you were close, but statpanels at present only expect an object in the stat itself, not its prefix. Since you used the stat(prefix, object) format, M would have to go second in order to show up. Of course a temporary obj in a statpanel is unlikely to work well in any case, so I'd consider this the poorer of the two approaches.

So basically, all you have to do is take your first example and put an actual object in the \icon macro, or use the <img> tag directly:

stat("<img class=icon src=\ref['misc.dmi'] iconstate='8'>", gil)


Lummox JR
In response to Lummox JR
Okay, that didn't work out either, it just showed the html instead of the picture. I think this is a problem with allow-html?
In response to Plug and Play
The winset() that sets up allow-html is inside an ill-formatted spawn() statement, so that could potentially be part of it. Why not set this up in the skin file itself?

Lummox JR
In response to Lummox JR
I am not using an interface file, I am trying to just use the default one for now.
In response to Plug and Play
Plug and Play wrote:
I am not using an interface file, I am trying to just use the default one for now.

Couldnt you just use Help On... Function (F1)?
Format:
stat(Name,Value)
Args:
Name: the name of the stat line
Value: the data to be displayed

you was trying to show icon in the name, I have no idea if it's possible, if yes it must be hard ;P
anyway Value is the place for the icon

mob
Stat()
statpanel("Stats")
stat("[src.gil]",new/obj/statobjects/copper)


PS. I resolved your problem so now people can help to resolve my problem ;P
In response to Kisioj
Kisioj wrote:
you was trying to show icon in the name, I have no idea if it's possible, if yes it must be hard ;P
anyway Value is the place for the icon

> mob
> Stat()
> statpanel("Stats")
> stat("[src.gil]",new/obj/statobjects/copper)
>

PS. I resolved your problem so now people can help to resolve my problem ;P

As noted earlier in this very same thread, a temporary object is not safe to use in statpanels. Results may be unpredictable.

Lummox JR
In response to Lummox JR
Yeah, I caved in and started reading up on the interface system... Thanks for the help it worked fine after I made my own interface.
In response to Plug and Play
couldn't they just put the object in the contents and give that an icon?

like...

Stat()
statpanel("Thingy")
if(statpanel("Thingy"))
for(var/apple/A in contents) stat(A)