ID:264340
 
Code:
var/list/Banned_Names = list("someone")
mob/verb/Rename_Self()
var/Name = input("","") as null|text
if(!Name) return
for(var/A in Banned_Names)
if(findtext(Name,A))
alert("Illegal name detected!","ERROR")
return
name = Name


Problem description:

For some reason no matter what I type in, findtext() somehow matches it to one of the entries in my list >_> I use this method to find symbols, and it works 100%. But it started being all screwy when I added in the banned names feature to it. Any reason why?
var/list/Banned_Names = list("someone")
mob/verb/Rename_Self()
var/Name = input("","") as null|text
if(!Name) return
for(var/A in Banned_Names)
if(findtext(Name,A))
src << "Invalid name!"
return
name = Name
src << "Name changed to: [name]"


Works fine for me...
Perhaps you're overlooking the fact you're searching for the 'word' throughout the whole string; so if you have a forbidden name that is partly contained in the chosen name in any form, the condition will return true. So ie having "girl" banned and using "Spunky_Girl" will come out to be an "illegal name detected".
In response to Kaioken
This, however, is not the case, unless it includes partial letter combinations as well.

I have an entire list with upwards of 20 names in it (all single word names, no symbols and whatnot), and I type in a name that's not in the list, like "Kitty" for example, and it's giving me the alert message. I don't want to use findText() because I don't want it to be case sensative.
In response to Spunky_Girl
Is there a null or "" entry in the list?
In response to Immibis
Ha! There is! I just took it out, and it works now. Thanks Immibis :)