Unique Character Names - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d) +--- Forum: Script Submissions (/Forum-Script-Submissions) +--- Thread: Unique Character Names (/Thread-Unique-Character-Names) |
Unique Character Names - Mordaunt - 03-15-2013 05:05 AM This thought entered my mind in answer to a question on the forum. Logging player names (as characters are created) and storing then in a list which is then checked (as characters are created) to see if the chosen name already exists. If a match is found, the new player is stoned and presented with an unclosable unmoveable gump asking them to choose a new name, if that name passes the list they are free'd and allowed to continue their game. Entries in the list are removed when a character is deleted, so if for whatever reason you wish to delete and remake a character with the same name it will allow you. Darksun84 ran a test on lists while I was messing with this and received only a 90mb increase in the memory useage of sphere for a list with 1,000,000 entries. Yes that's a million. So the likelyhood of this script hogging your computer's memory is slim. Unique Character Names This script does not provide support for existing shards who may now wish to implement a unique name policy. Not because it can't be done (it definately can) but because it is a headache if 2 players have the same name... who gets to keep it? If it turns out that this feature is in demand I will work it into the script, though I accept no responsibility for the arguments it may bring. RE: Unique Character Names - xwerswoodx - 03-19-2013 03:25 AM But I think, In the real world you can use same name more than once. But may be someone wants this. Thanks for script RE: Unique Character Names - gooool - 04-01-2013 04:00 PM Where to get player_names??? Where to put tell us more? I have a message when you create a new character 12:54:ERROR:(test.scp,241)Can't resolve <serv.LIST.player_names.COUNT> 12:54:ERROR:(test.scp,248)Undefined keyword 'LIST.player_names.ADD' RE: Unique Character Names - Mordaunt - 04-01-2013 10:22 PM You don't "get" the names. The script records them as players make characters. All that is really required to run this script is for the following to appear under the server triggers: Code: [FUNCTION f_onchar_create] RE: Unique Character Names - gooool - 04-02-2013 01:47 AM Under what Tiggeru? on=@login ? RE: Unique Character Names - Mordaunt - 04-02-2013 03:24 AM server triggers... In sphere_serv_triggers.scp Open the file you will see the functions that match [FUNCTION f_onchar_create] [FUNCTION f_onchar_delete] RE: Unique Character Names - gooool - 04-02-2013 07:15 PM I have a message when you create a new character 12:54:ERROR:(sphere_serv_triggers.scp)Can't resolve <serv.LIST.player_names.COUNT> 12:54:ERROR:(sphere_serv_triggers.scp)Undefined keyword 'LIST.player_names.ADD' Sphere 56b RE: Unique Character Names - Mordaunt - 04-02-2013 10:19 PM What server version and build number are you using? (build number is in the top right of the console when you start sphere) This script works with no problems when correctly installed I re-verified this morning on a completely blank server, this is what you should be seeing when the script first runs and starts the unique name list: Code: 07:17:2:Setup_CreateDialog acct='Mordaunt', char='Mordaunt' RE: Unique Character Names - gooool - 08-06-2013 10:49 PM Do not get me on every pereprobyval. Help for installation steps. Help sphere_serv_triggers.scp in a component of [FUNCTION f_onchar_create] if <serv.LIST.player_names.COUNT> if <serv.LIST.player_names.FINDELEM "<src.name>"> != -1 src.timerf 3, src.namechange else serv.LIST.player_names.ADD <src.name> endif else serv.LIST.player_names.ADD <src.name> serv.log Unique player name list created endif [FUNCTION f_onchar_delete] serv.LIST.player_names.<LIST.player_names.FINDELEM "<src.name>">.REMOVE unique_name.scp in a component of [function namechange] src.flags=(<src.flags>|040000) src.sysmessage The name you have chosen is not available src.sysmessage You will remain frozen until you choose a new name src.dialog d_name_change [Dialog d_name_change] 150,220 nomove noclose page 0 // Basic layout gumppictiled 0 0 310 150 0a40 checkertrans 1 1 308 148 dtext 80 10 90 Please choose a new name gumppic 20 50 1143 0 dtextentry 30 52 150 50 0 0 dtext 200 120 90 Confirm button 250 120 0fa5 0fa7 1 0 1 [Dialog d_name_change BUTTON] ON=1 if <serv.LIST.player_names.FINDELEM "<argtxt[0]>"> != -1 src.sysmessage The name you have chosen is not available src.sysmessage Please chose a different name src.dialog d_name_change else if strregex(^[a-z]+$,<argtxt[0]>) local.length=<argtxt[0]> if (<eval strlen(<local.length>)> < 3) || (<eval strlen(<local.length>)> > 16) src.sysmessage Invalid name src.sysmessage Valid names must me 3 - 16 characters in length src.dialog d_name_change else serv.LIST.player_names.ADD <argtxt[0]> src.name <argtxt[0]> src.flags=(<src.flags>& ~040000) src.sysmessage You name is now <src.name> endif else src.sysmessage Invalid name src.sysmessage Names may only contain letters a - z src.dialog d_name_change endif endif When you create a new character server swears: 19:51:ERROR:(sphere_serv_triggers.scp,54)Can't resolve <serv.LIST.player_names.COUNT> 19:51:ERROR:(sphere_serv_triggers.scp,61)Undefined keyword 'LIST.player_names.ADD' 19:51:(sphere_serv_triggers.scp,62)Unique player name list created HELP HELP HELP RE: Unique Character Names - Mordaunt - 08-07-2013 12:09 AM 6 months have passed since you last asked this question, you have not provided any further information which makes it impossible to assist you. I have once again run tests on this script on my own server and short of making a small unrelated update to it, cannot replicate your problem. Please say which version and build of sphere you are using. I would suggest updating to the pre-release anyway v1.1 Added check to prevent loss of dialog by logging out or being disconnected. Never really thought about it before but it caused an issue in that on logging back in the player would not be presented with the name change dialog, essentially circumventing the script, but would also be stoned and unable to do anything about it without GM intervention. |