Jump to content
Sascha Steampunk

Tail Script to say display name instead of username

Recommended Posts

So I am trying to update some of my old tail scripts. They are the kind that when you click on the tail it gives you a menu with options like hug, pet, brush, and so on. I had gotten a full perm tail script about 10 years ago and have heavily modified it for my personal use in my tails. What I am having trouble with is getting it to say the display name (the name you can change every 7 days) of both the wearer and the person clicking the options on the tail instead of saying the legacy name (the name you use to login).

 

**EDIT**

This is pretty much where im having a hard time. I only copy and pasted a portion of the script since I am sure no one needs or wants to see what all options I have for the script lol. I am also pretty sure that this is the portion that needs to be fixed in order for it to save and work properly so if someone can maybe show/tell me what and how this portion needs to be changed that would be great.

string owner;
integer lock = FALSE;
integer listn;
integer rand;
integer chan;
string toucher;
integer listener;
key dk;

default
{
    attach(key n)
    {
        llResetScript();
    }
    
    on_rez(integer n)
    {
        llResetScript();
    }
    state_entry()
    {
        
        chan = 100 + (integer)llFrand(20000);
        owner = (llGetDisplayName(<key id>));
        
    }

    touch_start(integer total_number)
    {
        listener=llListen(chan,"","","");
        llOwnerSay("Your tail is being touched by " + llDetectedName(0));
        toucher = llDetectedName(0);

Edited by Sascha Steampunk

Share this post


Link to post
Share on other sites

Script Testing Box: Your tail is being touched by Rythm A Hart

Script Testing Box: Your tail is being touched by Lyric A Hart 

Script Testing Box:  AzorieSoloWolf Resident yanks Sascha Steampunk's tail causing Sascha Steampunk to look back at AzorieSoloWolf Resident with an annoyed look

 

My display name is Rythm A Hart and AzorieSoloWolf's display name is Lyric A Hart. The last part of what the script testing box posted is the part of the script that isn't working like I need it to. It is still saying the legacy names instead of the usernames. I would just post the entire script in here but it is a naughty tail script so I don't think it's a good idea to post the entire script on the forums lol. If someone is willing to TP to me in world I can show the entire script there though so corrections can be made.

Share this post


Link to post
Share on other sites

You already have two global variable, named owner and toucher.  Your script defines owner = llGetDisplayName (key id); which I recommend changing to owner = llGetDisplayName(llGetOwner());    Later, you have toucher = llDetectedName(0); , which I recommend changing to toucher = llGetDisplayName(llDetectedKey(0);    Once you have done this, you have your two names saved in the script as display names.   Wherever they appear in the rest of your script, those definitions will apply, as in  llOwnerSay("Your tail is being touched by " + toucher);   You just need to be sure that your definitions of owner and toucher are before the first time they are used.  So, for example, reverse the order of the two lines in 

       

     llOwnerSay("Your tail is being touched by " + llDetectedName(0));
     toucher = llDetectedName(0);

to make them
       

     toucher = llGetDisplayName(llDetectedKey(0));
     llOwnerSay("Your tail is being touched by " + toucher);

instead.

Share this post


Link to post
Share on other sites

I strongly recommend to use the Viewer URI Namespace whenever possible, example:

  • secondlife:///app/agent/UUID/about
  • secondlife:///app/agent/UUID/displayname
  • secondlife:///app/agent/UUID/username

It should work for llDialog (but not the buttons), llSay, llWhisper, llShout, llOwnerSay

Won't work for prim names and llSetText tho.

The main advantage is that you work strictly with UUIDs and let the user's viewer deal with converting it into the current display name. And as a bonus i think it will also respect their settings if they only want to see usernames instead.

 

Edited by Kyrah Abattoir

Share this post


Link to post
Share on other sites
7 hours ago, Sascha Steampunk said:

Just tried that now and went to save it and now it says there is a syntax error for this ----> llDialog(dk,"Change Tail option,",["lock","unlock"],chan);

Without seeing the line in context, it's hard to tell, but the most common reason for getting that error is that you omitted the semicolon at the end of the previous line.

Share this post


Link to post
Share on other sites

a quick example to test with?



integer lock = FALSE;
integer chan;
key owner_key;
key toucher_key;
string owner;
string toucher;
integer listener;
integer offset = 100;

default
{
    attach(key n)
    {  llResetScript();
    }    
    on_rez(integer n)
    {  llResetScript();
    }
    state_entry()
    {  chan = 0x80000000 | (integer)("0x"+(string)llGetOwner());  
       chan += offset ;
       chan = -chan;
       owner_key = llGetOwner();
       owner = llGetDisplayName( owner_key );  
    }
    touch_start(integer total_number)
    {  listener = llListen(chan,"","","");
       toucher_key =  llDetectedKey(0);
       toucher = llGetDisplayName( toucher_key );                
       llOwnerSay("Your tail is being touched by " + toucher );
       if( toucher == owner)
       { llDialog( owner_key,"Change Tail option",["lock","unlock"],chan);         
       }
       else
       {  llDialog( toucher_key,"Choose an action",["pull","yank"],chan); 
       }      
    }
    listen(integer channel, string name, key id, string message)
    {   llListenRemove(listener);
        if( message == "lock")
        {   llOwnerSay(" Locking Tail..." ); // do lock stuff
        }
        if( message == "pull")
        {  llSay(0,"\n" + toucher + " yanks " + owner + "'s tail causing " + owner + " to look back at " + toucher + " with an annoyed look." );
        }
        // etc etc
    }
}

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...