Jump to content

Object copying Avatar Display Name or Username


Guest
 Share

You are about to reply to a thread that has been inactive for 3094 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Today I am sharing a script that I use for a game HUD. The HUD is imitating dialogs by speaking for the Player in open chat. So it needs to imitate the player name.

Most people have display names that are very different to their usernames. However usually scripts don't use display names for imitating a player name in chat, because some players use special characters like "π", "ß" or "à" in their display names. These letters cannot be used for object names and are replaced by question marks when being called by a script.

My display name is "Stella π" and if I try to give an object my display name, it will show in chat as "Stella ??". This is a problem only for 5% to 10% of all users, but big enough so that no script that I know uses display names. They all refer to the username instead.

However there are so many people that have chosen silly names when registering and their display names differ a lot. I would say that 5% to 10% of SL players have such silly user names. Also more than 50% of all users have display names that differ a lot from their original usernames. Why should all these people suffer for the few who can't chose display names with simple letters (like me)?

It is a real immersion breaker if a spanish speaking avatar with the Display name "Mr. Tequilla" says something and then the script translator repeats his message with the username "X0ppTrom Resident".

Isn't there a better solution? Here you get one. The object runs a test if the object contains question marks after the renaiming from display name. If there is no question mark, the display name is used. So from now on 90% of all people will get their display name in chat.

In case that the display name contains however special characters then the script will chose the username instead.

I think that this script snippet could help a lot to improve immersion when objects immitate an avatar name in chat that is actually displayed to everyone.

Below you will find a proof of conecpt. Put it in a prim and touch it.

EDIT: Replaced a function with llSubStringIndex and changed the chat message, so that it becomes more obvious, what the script is doing.

 

string chatName;
string oldName;
integer found;

default
{
    state_entry()
    {


        oldName = llGetObjectName(); //let's save the original object name of the object containing the prim 
        llSetText("I am an identity thief. \n Click me to lend me your name.", <1.0, 1.0, 1.0>, 1.0);  

    }

    touch_start(integer total_number)
    {
//Let's get a fake chat name from the display or username//////////////////////////////////////////////////////////

//Set the object name to the display name
        string displayName = llGetDisplayName(llDetectedKey(0));
        llSetObjectName(displayName);

//Now we will run a test if the display name contains any special letters, that are not accepted as an object name.
//Such letters are replaced with a "?" in the object name//////////////////////////////////////////////////////////
        string newobjectName = llGetObjectName();
        
        found = llSubStringIndex(newobjectName, "?");
                
        if (found == -1) //In this case no "?" has been found in the object name. This means that we can use the display name.
            {
                chatName = llGetDisplayName(llDetectedKey(0));
                llSetObjectName(chatName);
                llSetText("My name is now " + chatName +".", <1.0, 1.0, 1.0>, 1.0);  
                llSay(0, "I have stolen the identity of " + chatName + ". I used your display name as it does not contain incompatible letters.");
            }
        
        else //In this case there has been an "?" in the object name. This means that we need to chose the username.
            {
                key id = llDetectedKey(0);
                chatName = llKey2Name(id);
                llSetObjectName(chatName);
                llSetText("My name is now " + chatName +".", <1.0, 1.0, 1.0>, 1.0);  
                llSay(0, "I have stolen the identity of " + chatName + ". I used your username as your display name contains incompatible letters.");
            }
       
        
        //llSay(0,chatName);

        llSleep(3.5);
        llSay(0, "I am going back to sleep");
        llSleep(1.5);
        llSay(0, "*SNORE*");
        llSetObjectName(oldName);
        llSetText("I am an identity thief. \n Click me to lend me your name.", <1.0, 1.0, 1.0>, 1.0);

    }
}

 

  • Like 1
Link to comment
Share on other sites

Thanks, I changed the script accordingly.

I wouldn't say that no system is perfect, but it is not possible to cater everyone's needs. I didn't know that it is possible to change the settings in the viewer so that the open chat will only show usernames. I have never met anyone who does that and it is a strange behaviour in my eyes. You would be ignoring how people arround you are approaching each other and want to be approached.

I am frankly more worried about the 0,01% of people who chose a username display name containing a ? on purpose...    ;)

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...
You are about to reply to a thread that has been inactive for 3094 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...