ID:148907
 
i want my 'say' verb to message people different things,depending on their distance...

here's what i got so far:
mob/verb/Say(msg as text) // Say command, say to somone in your range.
set category = "Social"
var/mob/M
for (M as mob in view(6))
M << "\icon[usr][usr] Says, [msg]"
for (M as mob in view(10))
M << "Someone Says, [msg]"

it all works fine,except...
it happens TWICE O_o;

(yes,it's lightly based on a demo ^_^ RaeKwon's to be exact ~_~; )
Roara wrote:
mob/verb/Say(msg as text) // Say command, say to somone in your range.
set category = "Social"
var/mob/M
for (M as mob in view(6))
M << "<font color = white>\icon[usr][usr] Says, <font color = aqua>[msg]"
for (M as mob in view(10))
M << "<font color = white>Someone Says, <font color = aqua>[msg]"

it all works fine,except...
it happens TWICE O_o;

That's because everyone who is in view(6) is also in view(10) (in other words, everyone who is less than 6 spaces away is obviously also less than 10 spaces away). Therefore they see the results of both for loops. So in the second for loop, what you really want to do is loop over people who are in view(10) but not in view(6). You could change it to loop over view(10) - view(6), but that's slightly inefficient because BYOND would have to calculate view(6) a second time. Even better, just store both views as list variables. What you could do is something like this:
mob/verb/Say(msg as text) // Say command, say to somone in your range.
set category = "Social"
var/mob/M
var/list/closeview = view(6)
var/list/farview = view(10) - closeview
for (M as mob in closeview)
M << "<font color = white>\icon[usr][usr] Says, <font color = aqua>[msg]"
for (M as mob in farview)
M << "<font color = white>Someone Says, <font color = aqua>[msg]"
In response to Air Mapster
thanks ~_~;

and i knew dat,i just didnt know how to get around it -_-;