var/list/q = list(icon_states(src.armor.icon))
if(q.Find("q"))//It's in there
world << "Q"//Returns nothing
Of course, the obj that armor is set to exists. And the icon_state is there, yet it returns nothing...please help me.
Thanks for reading.
ID:268947
![]() Jan 2 2005, 12:00 am
|
|
var/list/q = list(icon_states(src.armor.icon)) Of course, the obj that armor is set to exists. And the icon_state is there, yet it returns nothing...please help me. Thanks for reading. |
Ok I just tried it on my own and this seems to work if the icon has the icon state:
mob/var/obj/armor/P |
The only reason that that wouldn't work is if src.armor doesn't exist or that its icon is null. Try this:
var/list/q = list(icon_states(src.armor.icon)) |
icon_states() returns a list. When you declare q, you're put that list inside another list. =)
var/list/q = list(icon_states(src.armor.icon)) |
This works because you create an empty list, then add the other list to it. With BYOND's += operator handling lists being added to other list differently than objects being added to lists, you end up with an exact copy of what icon_states() returns. =)
|
DeathAwaitsU wrote:
So is there anything wrong with the way I did it(minus the extra lines of coding)? I don't think so...but I didn't try it. You were sending a list to a non-list. |
and you also need for it to have [] around it,[q].
var/list/q = list(icon_states(src.armor.icon))
if(q.Find("q"))//It's in there
world << "[q]"//Returns nothing