ID:1957769
 
(See the best response by Super Saiyan X.)
silly question, but what i need in the code below is to take the usr himself out of the P list

mob/player
verb/random_crap()
var/mob/player/P
for(P in view(0))
P << "randomcraphere"


but whenever i try this:

P -= usr


it gives me a runtime error. the Remove() proc doesn't work either (this:)

P.Remove(usr)


that doesn't work because DS doesn't even recognize the remove proc.
point is, I need to take the usr out of that list and i'm either too dumb or too sleepy to figure out how. just seems like a though task as the usr is obviously in its view(0), but i want all player mobs except the usr himself to receive the "randomcraphere". pls halp
You can use 'oview' instead of 'view' to omit the center.

You also don't need to define P on the line above the loop.

for(var/mob/player/P in oview(1))
P << "Stuff"


But for future reference you can do something like:

for(var/mob/player/P in mylist-usr)
// ...
but that's the problem, i can't use oview, it has to be in view(0), which includes the player
Best response
P isn't a list.

If you're trying to loop over a list of people, and output something to everyone besides 'usr' it's most easily done like this:
for(var/mob/player/P in view()-usr) //This is literally subtracting 'usr' from the list generated by view().
//do the thing


Be aware that you are providing 0 as the distance to view(). This will only include mobs on the same tile as the usr.
In response to Super Saiyan X
that's exactly what i needed.
and yeah i'm aware of that.
thank you!
view(0)-usr is literally oview(0).

In response to Nadrew
oh. i thought oview excluded the whole tile itself
It excludes the 'center' argument, which defaults to 'usr'.
oview() also excludes the center's contents.