ID:142360
 
Code:
mob/verb
CAL()
set name = "Captains And Leaders"
set category = "Commands"
for(var/mob/M)
if(M.Captain)
usr << "Squad One Captain: [squad1]"
usr << "Squad Two Captain: [squad2]"
usr << "Squad Three Captain: [squad3]"
usr << "Squad Four Captain: [squad4]"
usr << "Squad Five Captain: [squad5]"
usr << "Squad Six Captain: [squad6]"
usr << "Squad Seven Captain: [squad7]"
usr << "Squad Eight Captain: [squad8]"
usr << "Squad Nine Captain: [squad9]"
usr << "Squad Ten Captain: [squad10]"
usr << "Squad Eleven Captain: [squad11]"
usr << "Squad Twelve Captain: [squad12]"
usr << "Squad Thirteen Captain: [squad13]"
usr << "<br>"
if(M.EspadaL)
usr << "Espada Leader: [EspadaLeader]"
if(M.QLeader)
usr << "Quincy Veterian: [QuLeader]"


Problem description:
[squad1] - [squad13]

Is the Captain's name of that squad.

The verb is suppose to show the Captains/Leader of each squad/race, online or offline. Instead it shows:

















Yup, just a load of < br>'s, and it carries on for ages.
whats for(var/mob/M) doing its not searching anywhere.

examples for(var/mob/M in world) for(var/a in list)
In response to A.T.H.K
The ref states that if nothing is provided, it defaults to world.
In response to A.T.H.K
I was thinking if I put for(var/mob/M in world) then the person who has the captain/leader would need to be logged in and I already have a Captains 'online' verb, which works fine...

mob/verb
Captains_Online()
set category = "Commands"
var/tmp/CO = 0
for(var/mob/M in world)
if(M.online)
if(M.Captain)
usr << "<b><font color=red>[M.name] ([M.key]) - [M.rank12]"
CO += 1
usr << "<b><font color=red>Number Of Captains Online: [CO]"
CO = 0


If you see anything wrong with that (I don't...) please feel free to point out what, but yea, that's not my problem.
In response to Popisfizzy
Popisfizzy wrote:
The ref states that if nothing is provided, it defaults to world.

ehh really? i need to read it again i have lost touch since 4.0
Because you're looping through every single mob in the world for some reason. All you should need are those outputs, nothing else.
In response to A.T.H.K
It's been like this before as well, it wasn't changed in BYOND 4.0. It should be mentioned though that it doesn't default to world/world.contents, that is inaccurate - it probably loops through all instances of the type in a different method, because you can indeed use it to loop through non-atom instances, custom type instances and non-datum instances. For example, for(var/client/C) and as such work, but such objects are never in world.contents.
In response to Popisfizzy
It actually says it default to 'the whole world' which isn't the same as world.contents -- since clients are never actually inside of world.contents you'd end up with it failing on for(var/client/C) if it defaulted to world.contents. It really defaults to everything.