ID:169148
 
client
var/list/ignore
verb
Ignore(_ckey as text)
if(_ckey)
if(!src.ignore) src.ignore = list()
src.ignore += _ckey
src << "<b style=\"color:black\">You are now ignoring [_ckey].</b>"
else if(src.ignore && src.ignore.len)
if(src.ignore.len == 1) src << "<b style=\"color:black\">You are currently ignoring [src.ignore.len] person:</b>"
else src << "<b style=\"color:black\">You are currently ignoring [src.ignore.len] people:</b>"
for(var/ignored in src.ignore) src << "- [ignored]"
else src << "This verb uses the following format:\n\\ignore \"\[troll name\]\""

Unignore()
if(!src.ignore || !src.ignore.len)
src << "You aren't currently ignoring anyone."
return 0
var/extroll = input(src,"Who would you like to unignore?","Unignore") as null | anything in src.ignore
if(extroll)
src.ignore -= extroll
if(!src.ignore.len) src.ignore = null
src << "You've unignored [extroll]."
mob
verb
say(t as text)
for(var/mob/M in world)
if(!M.client||src in client.ignore)continue
else
world<<"[src] says: [t]"


Now this is not ignoring, People can still s how their text. When a player adds someone they talk once and it shows their message two times. How can I fix this in Say()?

Please note the Ignore/Unignore was programmed by wizkidd0123

~>Jiskuha
As for the first problem, you need parenthesi around 'src in client.ignore' and it should also be M.client.ignore. For the second one, I don't notice why at first glance.

'in' has a low order of operation and therefor !client||src gets evaluated first. That evaluates to 1 (since src is going to be true) and makes that if statement equivalent to if(1 in client.ignore), which is always false and thus never executes.

If you are talking, and the person you are talking to doesn't want to hear you, that means you check M.client.ignore since M is the one recieving the message. Checking your own client.ignore would be like ignoring yourself.
In response to Loduwijk
mob
verb
say(t as text)
for(var/mob/M in world)
if(!M.client.ignore||(src in client.ignore))continue
else
world<<"[src] says: [t]"


I have this and now I cant even speak.

~>Jiskuha
In response to Jiskuha
I also said you need to change client.ignore to M.client.ignore.

Secondly, I edited my post explaining why both those things needed changing.
In response to Jiskuha
Ah, I just noticed something else. I don't know why it didn't hit me before.

You are adding the key to the ignored list, not the object itself. Therefor you want to check to see if src.ckey is in M.client.ignored, not just src.
In response to Loduwijk
Okay I think I understand and this is what I have so far.

mob
verb
say(t as text)
for(var/mob/M in world)
if(!M.client.ignore||src.ckey in M.client.ignore)continue
else
world<<"[src] says: [t]"


However if player 1 adds player2 to an ignore list player1 says things double to the world and you can still hear player2. After player2 is un-ignored he also speaks double. Why is it speaking double?

~>Jiskuha
In response to Jiskuha
You still need the parentheses in there. And I don't know about the double-speach, sorry.
In response to Loduwijk
Okay I fixed the double speech.

mob
verb
say()
var/T = input("What would you like to say", "Say") as null|text
if(!T) return
for(var/mob/M in world)
if(M.ckey in src.client.ignore)continue
M<<"[src] says: [T]"


However its still showing the ignored players text. Any help?

~>Jiskuha
In response to Jiskuha
In your loop where the if() 'continue's, the next line needs the 'else' or it will always be reached.
In response to Nadrew
mob
verb
say()
var/T = input("What would you like to say", "Say") as null|text
if(!T) return
for(var/mob/M in world)
if(M.ckey in src.client.ignore)continue
else
M<<"[src] says: [T]"


Still the same problem.

~>Jiskuha
Oh, for the love of... Here.

mob
var
mute
list/ignored


verb
say(msg as text)
msg = clean_msg(msg, "say")

if(!length(msg)) return

if(mute)
src << "<b>[src.name]</b>: [html_encode(msg)]"
return

for(var/mob/M in world)
if(src.key in M.ignored) continue
M << "<b>[src.name]</b>: [html_encode(msg)]"


tell(mob/M as mob in world, msg as text)
msg = clean_msg(msg, "tell", M)

if(!length(msg)) return

if(mute)
src << "<i>You tell [M.name]:</i> [html_encode(msg)]"
return

if(M==src)
src << "<i>You tell yourself:</i> [html_encode(msg)]"
else
src << "<i>You tell [M.name]:</i> [html_encode(msg)]"
if(src.key in M.ignored) return
M << "<i>[src.name] tells you:</i> [html_encode(msg)]"


ignore(mob/M as null|mob in world)
if(!M)
if(!ignored || !ignored.len)
src << "You are not currently ignoring anyone."
else
src << "You are currently ignoring:"
for(var/troll in ignored)
src << " [troll]"
return

if(M==src) return

if(!ignored) ignored = new
ignored += M.key
src << "You are now ignoring [M.key]"


unignore(M as null|anything in ignored)
if(!M) return
ignored -= M
if(!ignored.len) ignored = null
src << "You are no longer ignoring [M]."



proc
clean_msg(msg, mode, mob/target)
var/linebreak = findtext(msg, "\n")
if(linebreak)
var/overflow = copytext(msg, linebreak+1)
msg = copytext(msg, 1, linebreak)

spawn(25)
if(mode=="say") say(overflow)
else if(mode=="tell")
if(target) tell(target, overflow)

if(length(msg) > 512)
var/space, pos = findtext(msg, " ")
if(!pos) pos = findtext(msg, " ")

while(pos<513)
space = pos
pos = findtext(msg, " ", space+1)
if(!pos) pos = findtext(msg, " ", space+1)

var/overflow = copytext(msg, min(space+1, length(msg)))
msg = copytext(msg, 1, space)

spawn(20)
if(mode=="say") say(overflow)
else if(mode=="tell") if(target) tell(target, overflow)
if(mode=="me") me(overflow)
return msg

~X
In response to Nadrew
Actually, continue should completely skip it for the current atom being looped. I think anyway.