ID:150003
 
Alright, these stupid names like dbz3518053_35012 have got to go. I want to know how, upon login, I can use a proc that will search the name and remove all non-alphabet characters. Yeah, sounds a bit extreme, but I am an extreme guy :P

Polatrite, A.S.
Polatrite wrote:
Alright, these stupid names like dbz3518053_35012 have got to go. I want to know how, upon login, I can use a proc that will search the name and remove all non-alphabet characters. Yeah, sounds a bit extreme, but I am an extreme guy :P

Use this proc:
proc
RemoveDigits(string)
var/char
var/newStr
for(var/pos=1;pos<=lentext(string);pos++)
char = copytext(string,pos,pos+1)
if(text2num(char)==null) newStr += char

return newStr

Usage: src.name = RemoveDigits(src.name)


/Andreas
Polatrite wrote:
Alright, these stupid names like dbz3518053_35012 have got to go. I want to know how, upon login, I can use a proc that will search the name and remove all non-alphabet characters. Yeah, sounds a bit extreme, but I am an extreme guy :P

Why not:
  • Limit names to 20 characters
  • Disallow any name where more than 4 or 5 digits are used

    I can see legitimate cases for spaces in names (like mine), and for numbers. The problem is the extreme use of either.

    Lummox JR
Polatrite wrote:
Alright, these stupid names like dbz3518053_35012 have got to go. I want to know how, upon login, I can use a proc that will search the name and remove all non-alphabet characters. Yeah, sounds a bit extreme, but I am an extreme guy :P

Polatrite, A.S.

You can use Vortezz's DBZ name blocker library.
Alright, I installed Gazoot's nifty little 'ditch the numero' proc, although I need a small add-on to get rid of symbols (except the underscore _) and spaces. Replace spaces with underscores, and just delete symbols... I know, I am quite picky, but when you type who in my game, it is specially set up (or will be) to display certain stuff in a certain format, and spaces and symbols mess it all up.
I built a name parser for TextMUD that make sure the names meet these requirements:

- the name must be > 3 and < 13 chars long
- the name must not be the same as the user's key (to increase role-playing spirit)
- the name must not be the same as any other registered player's name
- the name must concist of > 50% lower case letters
-- the name cannot be >50% capital letters
-- the name cannot be >50% numbers
- ckey(name) must be == lowertext(name), meaning that symbols are not accepted
Note: I plan to add more to this in the future!


Some people have mortal, bloody battles to the death with my name parser. In the end, though, the vast majority of people who log in choose reasonable, workable roleplaying names. I could release my name parser as a lib if the BYOND community requests it!
In response to Lord of Water
Yeah! I'll even pay you some dimes to get it before the public :P
In response to Polatrite
I'll see if I can seperate it from TextMUD and make it into a self-contained lib file. You'll just have to call Name() on login.
Here's the proc I use in my project. It only allows letters, spaces, commas, dashes, and apostrophes; names must be greater than 3 characters and less than 30; all words in a name must start with a capital letter; and there can be no capital letters except at the start of a word.
All in all, only realistic names will pass.

I haven't put it through extensive testing yet, but I think it works.

mob/proc/check_name()
if(lentext(name) < 4 || lentext(name) > 30) return 0
var/check_list[] = list("a","b","c","d","e","f","g","h","i","j","k","l","m","n" ,"o","p","q","r","s","t","u","v","w","x","y","z","-",",","'","`"," ")
var/last = " "
for(var/x in 1 to lentext(name))
var/cur = copytext(name,x,x+1)
if(!(last in list(" ","'","`")))
if(lowertext(cur) != cur)
return 0
else
if(lowertext(cur) == cur)
return 0
if(!(lowertext(cur) in check_list))
return 0
last = cur
return 1