When I use the who command, it firstly doesn't do anything. Secondly it Crashes my Dream Seeker. Heres the code:
mob
verb
Who(M as mob in world)
src << "Players Online:"
for(M in world)
src << "Name: [M] Icon: [icon] Muted: [Muted] Status: [status]"
ID:261680
Dec 28 2002, 8:27 am
|
|
Dec 28 2002, 8:32 am
|
|
M has no type value so it loops through every data type in the game, you'd be better off doing this,
|
You don't need the M as mob in world in the verb declaration. You just need to loop through the mobs in the verb itself:
<code> mob verb Who() usr << "Players Online:" for(var/mob/M in world) usr << "Name: [M] Icon: \icon[M.icon] Muted:[M.Muted] Status: [M.status]" </code> |
In response to OneFishDown
|
|
Even better:
<code>mob/verb/who() src << "Players Online:" for (var/client/C) src << "Name: [C.key] Icon: \icon[C.mob] Muted:[C.mob.Muted] Status: [C.mob.status]"</code> That's the shortest (in terms of code) and most efficient way I've found to loop through all the players in the world. |