ID:150219
 
Can someone please! show me an example of a who() verb with teams being a different color. I tried 3 different ways, but it only shows the other people on your team, not the whole world.
mob/player
var/color

mob/verb/who()
for(var/mob/player/M in world)
if(M.client) //If player is online
usr << "[M.name] ([M.color])"
In response to Gughunter
i think he means:

mob/player
var/color

mob/verb/who()
for(var/mob/player/M in world)
if(M.client) //If player is online
usr << "<font color=[M.color>[M.name]"
In response to Rcet
his code is exactley correct.....
In response to FIREking
I meant what the guy ASKING means.. and i hit enter and it posted it for some reason when i was writing. Read above for what i meant.
In response to Rcet
He wanted who() to indicate each player's team color as well -- that's the reason for the extra text.
In response to Gughunter
I thought he meant having the person's name the same color as what team he was on.
In response to Rcet
Rcet wrote:
I thought he meant having the person's name the same color as what team he was on.

Ahh, I get it now... not a bad idea at all. But you didn't put "code" tags around your example, so the forums took the HTML literally and I thought the green text just referred to the section you'd changed. Makes more sense to me now!
In response to Gughunter
I get a couple of errors...

who()
set desc="Current players on Paintball Outpost"
set category = "Communication"
for(var/mob/player/M in world)
if(M.client)
usr << "Current players online:"
usr << "Player - Team"
usr << "------------------------------"
usr << "[M.name] [M.color]"

paintball.dm:234:error:M.client:bad var
paintball.dm:238:error:M.name:bad var
paintball.dm:238:error:M.color:bad var
In response to Oblivian
LOL

Oblivian wrote:
I get a couple of errors...

who()
set desc="Current players on Paintball Outpost"
set category = "Communication"
for(var/mob/player/M in world)
if(M.client)
usr << "<Current players online:"
usr << "Player - Team"
usr << "------------------------------"
usr << "[M.name] [M.color]"


paintball.dm:234:error:M.client:bad var
paintball.dm:238:error:M.name:bad var
paintball.dm:238:error:M.color:bad var

tab all the bold lines one time in

FIREking
In response to Gughunter
mob
var/color

mob/verb/Who()
for(var/mob/M in world)
if(M.client)
usr<<"<font color=[M.color]>[M]"


Ah what the heck I thought I might as well give the code.
In response to Nadrew
Nadrew wrote:
mob/verb/Who()
for(var/mob/M in world)
if(M.client)
usr<<"<font color=[M.color]>[M]"

Ah what the heck I thought I might as well give the code.

And that would be good, if it closed the <font> tag. Of course, it's probably also desirable to print out the name of the color, like so:
mob/verb/Who()
for(var/mob/M in world)
if(M.client)
usr<<"<font color=[M.color]>[M] ([M.color])</FONT>"

Note your code will only work for simple color names like "red" and "blue" and such.

Lummox JR
In response to Lummox JR
Ack, I got used to not closing them again since DS does it for you but I know I should do it anyways. Good habit to get into again.
In response to FIREking
:P