ID:141692
 
Code:
mob
verb
Who()
set category = "Commands"
var/tmp/players
for(var/mob/M in world) if(M.client)
players += 1
usr << "[M.\icon] <B>[M]</B> ([M.level])"
usr << "Players online: [players]"


Problem description:I Can't show M icon on Who verb

I dont know what is wrong with my who verb, i need to show M icon but i can't, when i use Who command it shows ( example) :

Player.dmi, SuperSSJGoku (1)

How I can show the icon, not the icon name?
I'm pretty sure M cannot have vars like icon attached to it, try this:

usr << "[src.\icon]"


Let me know if it works.
In response to Hi1
I did ur code, but i changed for \icon[src] and it worked. Thanks
In response to Hi1
\icon isn't a variable, but you are both trying to access it like one. \icon is a text macro ('macros (text)' in the DM Reference, also 'icon text macro').
In such a case, consulting the reference is a smart idea:

The \icon macro is used to treat the following embedded expression (in []'s) as an icon rather than as text. An object, for example, would be replaced by its icon rather than by its name.
Example:
usr << "You look like this: \icon[usr]!"
In response to Schnitzelnagler
mob/player/verb
showicon()
usr << "You look like this: \icon[usr]!"


I used this to try and show my icon but it does not show it, it just leaves a blank spot
In response to Pirion
Does your mob have an icon? If not, of course it's going to show a blank spot.
In response to Mizukouken Ketsu
yes it does. lol a pretty crappy looking one but an icon none the less.
In response to Pirion
Do other images work? You could try a regular <IMG> tag.
In response to Kaioken
Kaioken wrote:
Do other images work? You could try a regular <IMG> tag.
        var/image/I = image('fantasy_warrior-200310-SM.jpg')
usr << "view icon \icon[I]"


tried this. still no image...

mob/player/verb
showicon()
usr << "<IMG CLASS=icon SRC=\ref'fantasy_warrior-200310-SM.jpg'>"

doesnt work either...