ID:142567
 
Code:
for(var/i in List)
stat("List", List[i])


Problem description:
I'm trying to write out a list inside the statpanel but it won't refresh the list, if I declare the list as List[4] it will show up as "List _blank_" four times, but when I change List[1]= "Hi" it doesn't update in the statpanel, "Hi" is in the list but it doesn't show up in the panel in the place of the first blank, I don't know why it isn't working
You have to override the Stat() (notice the capital S) proc to use the statpanel. Look it up in the reference, there are some examples.

Also, you don't have to break the list into individual elements with that for loop
mob
Stat()
statpanel("Stats")
var/counter=0
for(var/i in List)
counter+=1
if(List[counter]!=null)
stat("List", List[counter])


I resolved your problem ;)
In response to Nickr5
Thanks guys, but it's still doing the same thing, using that new code with the if(!null) in it just makes it so the list doesn't show up at all even when there are items in the list, I know there are items in there because when I use usr<< "[List[1]], [List[2]]" it shows me that they are not null but they aren't showing on the statpanel when they get new information, if I declare the List with "Hi" already in it, it will display "Hi" in the statpanel but if I change "Hi" in the list to, "Ho" it will stay as "Hi" in the stat panel
In response to Kisioj
You should be able to shorten
        for(var/i in List)
counter+=1
if(List[counter]!=null)
stat("List", List[counter])


to simply

stat("List", List)
In response to Nickr5
Nickr5, your "shorter" code won't work, it won't show variables from the list

Liens, my code works for sure, I tested it on my own computer. It may not work for you, maybe becuase you Add things to List not correctly!

Check out this code!

mob
Stat()
statpanel("Stats")
var/counter=0
for(var/i in List)
counter+=1
if(List[counter]!=null)
stat("List", List[counter])
mob
verb
AddToList(text as text)
List.Add("[text]")
In response to Kisioj
Yeah, you're right. I made a mistake
stat("List", List)
won't work, but
stat(List)
does.
In response to Nickr5
yes stat(List) will work, but I always make codes that you can modificate and upgrade like
mob
Stat()
statpanel("Stats")
var/counter=0
for(var/i in List)
counter+=1
if(List[counter]!=null)
stat("Position[counter]", List[counter])
In response to Nickr5
When I put stat("List", "[List]") it comes up in the statpanel as List /list. I tried your code in my code adding the text to the list the same and everything and it still doesn't change anything, how annoying maybe I should just use var1 var2 var3 and var4 instead
In response to Liens
just use
mob
Stat()
statpanel("Stats")
var/counter=0
for(var/i in List)
counter+=1
if(List[counter]!=null)
stat("List", List[counter])


or

mob
Stat()
statpanel("Stats")
stat(List)


Both codes work
In response to Kisioj
Doh.. I forgot to make it usr.List[i]= Textvar when I put them in... Thanks for all your help, I would have taken forever to figure it out otherwise. 5am.. time for bed..