ID:272610
Oct 19 2008, 6:37 pm
|
|
ok, i really just forgot how to make a who verb, if anyone could help me i would greatly appreciate it, just one that says Whos online and how many all together
|
Oct 19 2008, 8:45 pm
|
|
Use a for list loop. Namely, something like the following:
|
Instead of a verb, why not put it in a stat panel?
var/players = 0 Should work fine |
In response to Morpholic
|
|
Don't use for(var/mob/m in world) and then check if the mob has a client. Just check the clients directly.
|
In response to Popisfizzy
|
|
When I do that players stays equal to 1, but it prints the players name around...100 times or so. That's using
I unno it's 3:37 AM maybe I'm just tired >.< |
In response to Morpholic
|
|
...how does that even make sense?
for(var/client/c) |
In response to Morpholic
|
|
Looping through all players (or looping generally) on Stat() is very wasteful - it's going to do the same loop every 1-3 ticks for each player. Not only that, it most of the time will do it just to display the same values again, since players don't [dis]connect in lapses of 1/10 seconds. You should use a global players list, then just display it as it'd be pre-made. You can also use the len var to see how many players are logged in.
var/list/players = new() //define a new global list and initialize it |
In response to Morpholic
|
|
I tried yours first but it didn't work then i did
mob/Player Stat() statpanel("Who's Online") stat("Players Online: [players]") for(client in world) stat("\t\t[src.name]") and this says Maximum Number Of Stats Met when i start the game and it freezes |
In response to Ralphie_leo
|
|
As pointed out already by Popisfizzy, that guy's code made no sense. It clearly won't work.
|
In response to Kaioken
|
|
How do I get the below code to display each mobs' overlays along with their icon? Right now it just shows their base icon. |
In response to Mizukouken Ketsu
|
|
It should actually work completely fine for displaying overlays, AFAIK, and should do that with your code if the list has mob references (which I deduce you've made it keep track of those instead of the clients). Maybe you can provide more info, and ensure it's really overlays that are missing.
|
In response to Kaioken
|
|
Oh sorry. I must not have tested it before posting. It does work. Sorry lol.
|