ID:158200
 
mob
proc
updateStats()
var/list/statsList = typesof(/obj/stats/)
statsList -= /obj/stats/

var/list/finalStatsList = new/list()
for(var/stats in statsList)
finalStatsList.Add(new stats)

var i
for(i=1, i<=finalStatsList.len, i++)
winset(src,"statsGrid","current-cell=[i]")
src << output(finalStatsList[i], "statsGrid")

var/list/userStats = typesof(/var/stats/)
userStats -= /var/stats/

var a
for(a=1, a<=userStats.len, a++)
if(findtext("[statsList[a]]","[userStats[a]]"))
statList[a].icon_state = usr.userStats[a]


I'm looking to do some sort of typesof() for variables. Since I can't get it to work I assume that the typesof() doesnt work with them, so is there another function?

Also, I want to change the icon_state of an object in a list. I had this for for me in BYOND 3.5 when I used a bunch of for()'s for each obj, so I assume there is a way to do it in 4.0 and hopefully with a nice little list.

Any help is greatly appreciated!
Devin148 wrote:
I'm looking to do some sort of typesof() for variables. Since I can't get it to work I assume that the typesof() doesnt work with them, so is there another function?

Of course it doesn't work for them, it's for types - for "typesof() for vars" doesn't even make sense. You'll need to describe in detail what you want to do with vars here. A shot in the dark - maybe you're looking for the vars list?

Also, I want to change the icon_state of an object in a list. I had this for for me in BYOND 3.5 when I used a bunch of for()'s for each obj, so I assume there is a way to do it in 4.0 and hopefully with a nice little list.

You'd have to be more specific here for a worthwhile answer to be given as well. At any case you're going to obviously need to access the obj in the list in order to effect it, be it by manually looping through the list or not.
In response to Kaioken
If you want detail, look at the code...

I want to take a list[at i] which is an object, and change the icon state of the object that the list represents.

and maybe vars list ill take a look - thanks
In response to Devin148
You'll need to cast it to an atom first:

var/atom/A = list[i]
A.icon = blah
In response to Garthor
I already tried making it an object like that, and I just tried the atom way, and although it compiles the icon_state doesn't change :\
In response to Devin148
That's an issue with the list.