ID:266421
 
Can someone please help me get started on a code that puts an icon in the stat menu. Like say next to your gold stat you wanted an icon. How would you do that? Thank you
You do this by putting the object itself in the stat panel. Since objects have icons attached, when it shows the object in the stat panel, it will show the icon with it.

I think Zilal wrote a BYONDscape article, and I think it's non-subscription, on this, if you'd care to look it up.
obj/gold
icon = 'gold.dmi'


mob
var
goldicon
New()
..()
goldicon = new/obj/gold
Stat()
..()
statpanel("Gold")
stat("Oooh, gold",goldicon)


Something like that?
In response to Nadrew
Yes, but now that I have it showing the icon it won't let me set it so it shows the number anymore.

Code......

    Stat()
stat("---Stats---",src.desc)
if(src == usr) statpanel("Small Bag",src.contents)
stat("HP: ",HP)
stat("Strength: ",Strength)
stat("Defence: ",Defence)
stat("Gold: ",goldicon,Gold)///error
stat("Hunger: ",Hunger)
stat("Thirst: ",Thirst)
if(src == usr) statpanel("Quest Status",)
stat("Quests Finished: ",quests)
stat("Corn: ",corn)

Mob.dm:102:error:stat :expected 1 to 2 arguments (found 3).
In response to Foomer
Can't find it, I am signed up with byondscape ;P
In response to Little Sally
Click the "2002 Archive" link at the top of the page, then look for Z-Tips: Buttons in Statpanels.

(Or just click the link!)

In response to Little Sally
Little Sally wrote:
Yes, but now that I have it showing the icon it won't let me set it so it shows the number anymore.

If you have a goldicon set as an obj or atom of some kind, you can set goldicon.suffix="[gold] piece\s". Do this before the stat() call that shows goldicon. This should do exactly what you want.

Lummox JR
In response to Lummox JR
Like this? Im getting an error.

Stat()
stat("---Stats---",src.desc)
if(src == usr) statpanel("Small Bag",src.contents)
stat("HP: ",HP)
stat("Strength: ",Strength)
stat("Defence: ",Defence)
goldicon.suffix="[Gold] piece\s"
stat("Gold: ",goldicon)
stat("Hunger: ",Hunger)
stat("Thirst: ",Thirst)
if(src == usr) statpanel("Quest Status",)
stat("Quests Finished: ",quests)
stat("Corn: ",corn)


Mob.dm:104:error:goldicon.suffix:undefined var
In response to Little Sally
Little Sally wrote:
Mob.dm:104:error:goldicon.suffix:undefined var

If goldicon isn't an atom like an obj, suffix isn't a valid var. If it's just an icon, you can't set a suffix for it.

Lummox JR