Jump to content
You are about to reply to a thread that has been inactive for 270 days.

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

Recommended Posts

Hello! I am trying to figure out how to make a Script that, when a single prim is touched, it will publicly say something and includes the person name who touched it.

Example: 

Avatar touches prim. Prim emits publicly, "Johndoe touced the box"

Thanks in Advance!

Link to post
Share on other sites

default
{

    touch_start(integer start_param)
    {

        llSay(0,"Hello, your display name is " + llGetDisplayName(llDetectedKey(0)) + " and your user name is " + llDetectedName(0) + ".");

        llSay(0, llGetDisplayName(llDetectedKey(0)) + " touched the box");

         llSay(0,  llDetectedName(0) + " touched the box.");
    }
}

Link to post
Share on other sites
35 minutes ago, Emma Krokus said:

default
{

    touch_start(integer start_param)
    {

        llSay(0,"Hello, your display name is " + llGetDisplayName(llDetectedKey(0)) + " and your user name is " + llDetectedName(0) + ".");

        llSay(0, llGetDisplayName(llDetectedKey(0)) + " touched the box");

         llSay(0,  llDetectedName(0) + " touched the box.");
    }
}

Thank you a ton!

  • Like 2
Link to post
Share on other sites
32 minutes ago, Emma Krokus said:

default
{

    touch_start(integer start_param)
    {

        llSay(0,"Hello, your display name is " + llGetDisplayName(llDetectedKey(0)) + " and your user name is " + llDetectedName(0) + ".");

        llSay(0, llGetDisplayName(llDetectedKey(0)) + " touched the box");

         llSay(0,  llDetectedName(0) + " touched the box.");
    }
}

Not quite, I think.    If you want the usename, then use llGetUsername(llDetectedKey(0)), I think.    llDetectedName will give your full name (Innula Zenovka) if you have a last name, otherwise Joe123 Resident.   

  • Thanks 1
Link to post
Share on other sites
2 minutes ago, Innula Zenovka said:

Not quite, I think.    If you want the usename, then use llGetUsername(llDetectedKey(0)), I think.    llDetectedName will give your full name (Innula Zenovka) if you have a last name, otherwise Joe123 Resident.   

It worked :)

  • Like 1
Link to post
Share on other sites

There's no reason to be calling llDetectedKey and llDetectedName more than once each:

default
{

    touch_start(integer start_param)
    {
        key avatar = llDetectedKey(0);
        string name = llDetectedName(0);

        llSay(0,"Hello, your display name is " + llGetDisplayName(avatar) + " and your user name is " + name + ".");
        llSay(0, llGetDisplayName(avatar) + " touched the box.");
        llSay(0,  name + " touched the box.");
    }
}

 

  • Like 5
  • Thanks 1
Link to post
Share on other sites
  • 2 weeks later...

If you really want to be fancy (not that scripters would *ever* do that 😁), you can also address people with their first names only:

default
{

    touch_start(integer start_param)
    {
        key avatar = llDetectedKey(0);
        string name = llDetectedName(0);
	string firstName = llList2String(llParseString2List(name, [" "], []), 0);

        llSay(0,"Hello, " + firstName + "! Your display name is " + llGetDisplayName(avatar) + " and your user name is " + name + ".");
        llSay(0, llGetDisplayName(avatar) + " touched the box.");
        llSay(0, firstName + " touched the box.");
    }
}

 

  • Like 1
Link to post
Share on other sites
  • 2 weeks later...
On 7/12/2020 at 11:57 AM, Bugs Larnia said:

If you really want to be fancy (not that scripters would *ever* do that 😁), you can also address people with their first names only:


default
{

    touch_start(integer start_param)
    {
        key avatar = llDetectedKey(0);
        string name = llDetectedName(0);
	string firstName = llList2String(llParseString2List(name, [" "], []), 0);

        llSay(0,"Hello, " + firstName + "! Your display name is " + llGetDisplayName(avatar) + " and your user name is " + name + ".");
        llSay(0, llGetDisplayName(avatar) + " touched the box.");
        llSay(0, firstName + " touched the box.");
    }
}

 

Oh i like that!

  • Like 1
Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 270 days.

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...