ID:142912
 
Code:
mob
var/list
who
Login()
loc = locate(10,3,1)
world << "[usr.key] has joined this adventure!"
who += usr
..()
Stat()
statpanel("Who")
stat("Logged Players")
stat(who)
..()


Problem description:
I'm tying to make it so there is a tab with the players in the game in it(shows there icons and names) it works but it dosnt show anyone inside the tab besides yourself.
Thanks if u can help, if It would u could stop in the game and see how its not working byond://75.73.42.169:5773
I am guessing it dosn't work because it's under Login(). still not sure though
In response to Nategrant
It doesn't work because the who list isn't global. The fact that it's under login is just a common mistake.

var/list/who
client/New()
.=..()
if(.)
who += src

client/Del()
who -= src
..()
In response to Garthor
well i cant tell if it works are not because i'm only 1 on do u mind logging on and seeing if it works?
In response to Garthor
I don't think it works... but still not sure
garthor it dosn't work... how could I make it work?
That is a very, very, very bad idea.
In response to Nategrant
It probably doesn't work because you didn't add the list to the clients stat panel.
mob/Stat()
if(src.client)
statpanel("who",who)

var/list/who[0]
client/New()
.=..()
if(.)
who += src

client/Del()
who -= src
..()

Still not sure if it's working? You can easily check that by adding a few things to the list and see if they're displayed.
world/New()
who+="Hello"
who+="World."

Try that and let us know how it worked out.


In response to ErdricktheGreat
        statpanel("Who")
stat("Logged Players")
for(var/mob/m in world) if(m.client) stat(m)

i just used this from a friend Thanks!
In response to Nategrant
Garthor told you that this is a bad idea. You should really do it the way he told you to.
In response to Nategrant
I'd suggest not doing it that way as it will suck up resources. Why not just use a verb instead of the stat panel to show the clients online?
In response to ErdricktheGreat
While having a "Who" tab WILL use cpu and a bit of resources, just how many players will it take to cause any lag or decreased game function? I have a fairly advanced "Who" tab that actively shows how many players are on in the tab name as well as player names, keys, locations and levels in the tab. It is so much easier for me to look at a tab and see that my game has 8 players on than to use a who verb every time. Does it eat cpu and game resources? Yeah. A little. but no where near enough to effect the game.

Now if you have 50-60 players on at a time it may noticeably slow down but how many games constantly have more than 30 players on? From what I've seen most games aren't hosted enough to get that many people on for very long and if they are hosted 24-7, most don't seem to get that many players on at one time. Even the most popular games don't have that many on constantly. The games with 60 or more players listed have multiple games running so 100 players in 4 games is only 25 people per game.

If rsc are a concern, then have a who tab that reads a global player list that is only changed when players log on or off. You can define a global variable anywhere with var/global/VarName. Use var/global/list/Online and add players to that list and read it in the who tab. That will cut down rsc use.
In response to Jholder84
A who tab that uses a list will use almost no resources. A who tab that will loop through every mob in the game for every player in the game every second will use an absurd amount of resources.