ID:265020
 
Code:
mob
verb
Who()
Update_Who()
winshow(usr,"SocialMain",1)

proc
Update_Who()
var/Row = 1
for(var/mob/player/M in MasterPlayerList)
Row++
src << output("[M.name] <i>([M.key])</i> [M.AFK]","WhoGrid:1,[Row]")
Row++
src << output("<b>Player count:</b> [length(MasterPlayerList)]","WhoGrid:1,[Row]")
winset(src,"SocialGeneral.WhoGrid","cells=1x[Row]")


Problem description:
Code works fine after calling it a second time??
Why not just work the first time?

It could probably be caused by your second Row ++ which I don't see the need for in this Who code. The first one works, but the second doesn't. Unless you wanna call 1 row before and after every player.

Other then that I usually write out the whole path to my skins:
mob
verb
Who()
Update_Who()
winshow(usr,"SocialMain",1)

proc
Update_Who()
var/Row = 1
for(var/mob/player/M in MasterPlayerList)
Row++
src << output("[M.name] <i>([M.key])</i> [M.AFK]","SocialGeneral.WhoGrid:1,[Row]")
src << output("<b>Player count:</b> [length(MasterPlayerList)]","SocialGeneral.WhoGrid:[Row+1],[Row]")// If this is going below the players you might want to increment the var Rows so it can go one past the amount of Rows to become the last one.
winset(src,"SocialGeneral.WhoGrid","cells=1x[Row]")
In response to A. Ness (#1)
A. Ness wrote:
It could probably be caused by your second Row ++ which I don't see the need for in this Who code. The first one works, but the second doesn't. Unless you wanna call 1 row before and after every player.

You didn't read his code, I see. Read it as if it is executing in your head. The for() loop will execute, filling it up with players, then he ups the row one more time for the "Player count" to fit, instead of overriding the last player in the grid.
As for your issue, call a winset(src, "SocialGeneral.WhoGrid", "cells = 0x0") before anything else in the Update_Who() proc.
In response to Albro1 (#3)
Update_Who()
src << output("<center><font size =1><font color = yellow>Name","WhoGrid:1,1")
src << output("<center><font size =1><font color = yellow>Key","WhoGrid:2,1")
var/Row = 1

for(var/mob/M in world)
Row++
src << output("<center><font size =1>[M.name]","WhoGrid:1,[Row]")
src << output("<center><font size =1>[M.key]","Grid:2,[Row]")
winset(src,"SocialGeneral.WhoGrid","cells=1x[Row]")//Empties the grid of any existing values to avoid bugs.


But I don't understand - how come this works?
But adjusting it for 1 column doesn't?
In response to Saucepan Man (#4)
It should, if you set the cells to 0x0 at the beginning.
In response to Albro1 (#5)
winset(src, "SocialGeneral.WhoGrid", "cells = 0x0")
var/Row = 1
for(var/mob/M in world)
Row++
src << output("[M.name]","WhoGrid:1,[Row]")
winset(src,"SocialGeneral.WhoGrid","cells=1x[Row]")

Still no luck.

Perhaps I'm trying to transmute a snippet that cannt be transmuted.
Simply want a 1-column list to be outputted to a grid, ending with an output of a total player count.
I used a lib (because skins oft' confuse the pants off of me) for the grid; but it was originally a 2 column lib
In response to Saucepan Man (#6)
OOohh
I was trying to start frm Row=2
Apparently thats not the go with grids.
In response to Saucepan Man (#7)
There you go.