ID:146709
 
Code:
mob/var/list/ignoreing = new 

mob/verb/tell(mob/PC/M in world,msg as text)
if(usr in M.ignoreing)
if(M == usr)
M << "You told yourself, \"[msg]\""
else
M << "[usr] told you, \"[msg]\""
else
M <<"<b> [M] is ignoreing you!"



mob/verb/Ignore()
set category = "Communication"
var/whotoignore = input("Who do you want to ignore?","Type the name of the person you wish to ignore") as text|null
if(whotoignore == null)
return
else
if(whotoignore == key in world)
usr.ignoreing.Add(whotoignore)
usr<<"<b> \blue [whotoignore] is added to your ignore list!"
else
usr<<" <b> Sorry, [whotoignore] must be in the world to be ignored!"
mob/verb/Unignore()
set category = "Communication"
var/whotounignore = input("Who do you want to take off your ignore list?") as text|null
usr<< "[usr.ignoreing]"
if(whotounignore == null)
return
else
<b>usr.ignoreing.Cut(whotounignore)</b> //problem is here
usr<<"<b> \blue [whotounignore] is now off of your ignore list!"


Problem description:
The ignore function works fine, but how do I get the whotounignore to subtract from the list? I've never understood how to subtract from a list. Can someone please explain?
list.Remove("textstring")
//or
list.Remove(object)
//or
list-="textstring"
//or
list-=object
In response to AZA
Okay, thanks for that, I didn't know to use remove. I tried each of the examples, and they still don't fix the verb. Any idea why?
In response to Draxxis
yes, because you're inputting something into the list as a 'key' and you're pulling it out as a text string. You want to pull it out as a 'key' as well.
In response to AZA
Can you give me an example of what you mean?
In response to Draxxis
var/list/bleh=list()


mob/Login()
bleh.Add(src.key) //I've just added a KEY to the list.


mob/verb/test()
bleh.Remove(src.key) // I've just removed a KEY fromt he list.
mob/verb/test2()
bleh.Remove("[src.key]") // I've just attempted to remove the save value, but it didn't work.
for(var/A in bleh)src<<A //As you can see, the key is still in there.
In response to AZA
AZA wrote:
> var/list/bleh=list()
>
>
> mob/Login()
> bleh.Add(src.key) //I've just added a KEY to the list.
>
>
> mob/verb/test()
> bleh.Remove(src.key) // I've just removed a KEY fromt he list.
> mob/verb/test2()
> bleh.Remove("[src.key]") // I've just attempted to remove the save value, but it didn't work.
> for(var/A in bleh)src<<A //As you can see, the key is still in there.
>
>

The key IS a text string. If you actually tested that code it would work fine.
In response to Fuuhaa
So it does... well the fact remains that your problem is i fact what I said. You're removing a text string where as the object in the list is a client's key.
In response to AZA
The code you just posted proves that that's not the case. Assuming the player spelled the key correctly when they choose to unignore a key, it would work. The problem is that you're depending on your players' good spelling to make it work, which is bad. Instead, the unignore verb should prompt the player to select a key from their list of ignored keys directly, like so:

var/whotounignore = input("Who do you want to take off your ignore list?") in usr.ignoreing

//and then to remove them from the list

usr.ignoreing.Remove(whotounignore)
In response to Fuuhaa
I think the point of the verb is to use a text string.
In response to AZA
For the ignore verb maybe, but it makes no sense in the UNignore verb. It would only invite problems.
In response to Fuuhaa
Not my project. =]
mob/var/list/ignored=list()

mob/verb/Ignore()
var/list/a=list()
for(var/mob/m in world)
if(m.client)
a+=m.key
var/b=input(src,"Select a user below:","Ignore")as null|anything in a
if(b==null)return
for(var/mob/m in world)
if(m.key==b)
src.ignored+=m.key

mob/verb/Ignored()
if(src.ignored.len<1){src<<"Nobody is ignored.";return}
var/a=input(src,"Select a user below:","Unignore")as null|anything in src.ignored
if(a==null)return
src.ignored-=a

Try this, didn't have time to add notes, sorry. :/