ID:789027
 
Code:
mob
monster
icon = 'icons/monsters.dmi'

look_mob()
for(var/O as mob in oview())
usr << "[O.icon_state]" // this does not work but
// i need something like this that will work
usr << "You see: \a [O]"


Problem description:
i might be asking about something that can't be done, but i will ask anyways...

i have all the monsters in one .dmi file, with a name under each icon. when i run the code above and click the "look mob" verb, it outputs, "You see: monster" but is there a way to output the name of the icon. instead of the "You see: monster", it would output, "You see: wasp" if wasp was the icon_state of that icon.
That's because you're grabbing the name of the object, for the second statement at least.

Correction:Have you assigned an icon_state to the monsters you're checking?

However-

The easiest way to accomplish what you're trying to do is make a unique /monster/type for each monster and just define "name". Then pull O.name instead of fiddling with icon_state.

I mean, this looks like you're making things more complicated for yourself to make them look more organized.

You don't need to define icon_state for a mob, turf, area or object, as atom/ already contains icon_state, as will everything with atom/ as an ancestor.

Is there a reason you're not defining a name for each monster, as presumably they have states and such? Incidentally, 'name' is also a native variable for all atoms. So you don't need to define that, either.
In response to Jazztoken
Jazztoken wrote:
The easiest way to accomplish what you're trying to do is make a unique /monster/type for each monster and just define "name". Then pull O.name instead of fiddling with icon_state.

yes, i did that and it works great. thank you

what i was basically trying to do was extract the icon state from the multi icon file and see if that worked all from within the look verb. i guess it would not work