The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 2 Votes - 4.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unique Character Names
Author Message
Mordaunt
Super Moderator
****

Posts: 1,237
Likes Given: 26
Likes Received: 55 in 43 posts
Joined: Mar 2012
Reputation: 35



Post: #1
Unique Character Names
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.

[Image: 2nis46r.jpg]
(This post was last modified: 03-15-2013 06:56 AM by Mordaunt.)
03-15-2013 05:05 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
xwerswoodx
Journeyman
*

Posts: 86
Likes Given: 4
Likes Received: 7 in 4 posts
Joined: Jun 2012
Reputation: 0

UoMMO

Post: #2
RE: Unique Character Names
But I think, In the real world you can use same name more than once. But may be someone wants this.

Thanks for script
03-19-2013 03:25 AM
Find all posts by this user Like Post Quote this message in a reply
gooool
Apprentice
*

Posts: 18
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Feb 2013
Reputation: 0



Post: #3
RE: Unique Character Names
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'
04-01-2013 04:00 PM
Find all posts by this user Like Post Quote this message in a reply
Mordaunt
Super Moderator
****

Posts: 1,237
Likes Given: 26
Likes Received: 55 in 43 posts
Joined: Mar 2012
Reputation: 35



Post: #4
RE: Unique Character Names
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]
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

[Image: 2nis46r.jpg]
04-01-2013 10:22 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
gooool
Apprentice
*

Posts: 18
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Feb 2013
Reputation: 0



Post: #5
RE: Unique Character Names
Under what Tiggeru?
on=@login ?
04-02-2013 01:47 AM
Find all posts by this user Like Post Quote this message in a reply
Mordaunt
Super Moderator
****

Posts: 1,237
Likes Given: 26
Likes Received: 55 in 43 posts
Joined: Mar 2012
Reputation: 35



Post: #6
RE: Unique Character Names
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]

[Image: 2nis46r.jpg]
04-02-2013 03:24 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
gooool
Apprentice
*

Posts: 18
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Feb 2013
Reputation: 0



Post: #7
RE: Unique Character Names
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
(This post was last modified: 04-02-2013 07:20 PM by gooool.)
04-02-2013 07:15 PM
Find all posts by this user Like Post Quote this message in a reply
Mordaunt
Super Moderator
****

Posts: 1,237
Likes Given: 26
Likes Received: 55 in 43 posts
Joined: Mar 2012
Reputation: 35



Post: #8
RE: Unique Character Names
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'
07:17:(unique_name.scp,28)Unique player name list created
07:17:2:Setup_Start acct='Mordaunt', char='Mordaunt', IP='127.0.0.1'

[Image: 2nis46r.jpg]
(This post was last modified: 04-02-2013 10:19 PM by Mordaunt.)
04-02-2013 10:19 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
gooool
Apprentice
*

Posts: 18
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Feb 2013
Reputation: 0



Post: #9
RE: Unique Character Names
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
(This post was last modified: 08-06-2013 10:51 PM by gooool.)
08-06-2013 10:49 PM
Find all posts by this user Like Post Quote this message in a reply
Mordaunt
Super Moderator
****

Posts: 1,237
Likes Given: 26
Likes Received: 55 in 43 posts
Joined: Mar 2012
Reputation: 35



Post: #10
RE: Unique Character Names
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.

[Image: 2nis46r.jpg]
(This post was last modified: 08-07-2013 12:37 AM by Mordaunt.)
08-07-2013 12:09 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 7 Guest(s)