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

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

Recommended Posts

Posted

Hey all, 

Before I get into the weeds with LSL scripting, I wanted to know if the following was possible.

  • I am looking to write a script that will type a message when I sit on, & stand up from, an object.
  • Use case: I have 12 chairs.
    • I sit on Chair No 7. I then want a message to show in public chat (as me, not the object) "I'm sat on Chair 7".
    • I stand up from Chair No 7. I then want a message to show in public chat (as me, not the object) "Ready for my next task."
  • Knowing that I cannot edit the content of the chair, I will place this script in an object that will be attached to my body. 

Is what I am trying to accomplish doable? & if so, can someone push me in the right direction? I want to believe it is doable because I already have something similar to this. It's an object that (if i wear) sets my hover height to 0.000 when sat on an object, and then when I stand it reverts back to the previous value. The object is 'not modifiable' though so i cannot see how the script works. 

Thanks.
TenM.

Posted
1 hour ago, TenMell0w said:

sets my hover height to 0.000 when sat on an object

That functionality implies you're using RLV. in which case, the best way to detect when you sit or unsit on something is to use the '@notify' RLV command:

default
{
    state_entry()
    {   llListen(2222, "", llGetOwner(), "");
        llOwnerSay("@notify:2222;sat=add");
    }
    on_rez(integer i)
    {   llOwnerSay("@notify:2222;sat=add");
    }
    listen( integer chan, string name, key ID, string text)
    {   //llOwnerSay("Debug: "+text);
        list parse = llParseString2List(text,[" "],[]);
        if(llGetListLength(parse)==4) // example "/sat object legally 177aaada-9e0c-d93a-dbab-db739bc63f60"
        {   string sit = llList2String(parse,0);
            string object = llKey2Name(llList2String(parse,3));
            if("/sat"==sit)
            {   llOwnerSay("Sat down on "+object+".");
            }else if("/unsat"==sit)
            {   llOwnerSay("Stood up from "+object+".");
            }
        }
    }
}

Otherwise, I believe you have to constantly poll llGetObjectDetails(llGetOwner(),[OBJECT_ROOT]); for the key of the object the owner/wearer of the attachment is sitting on, if any.

Posted (edited)
1 hour ago, TenMell0w said:

(as me, not the object)

RLV* aware viewers will show text that comes from a worn attachment with a name set to the display name of the wearer as coming from the wearer, but if someone using for example, the LL viewer hears that attachment, they'll still see it as an attachment.

uSayAsMe(string s)
{   string name = llGetObjectName();
    llSetObjectName(llGetDisplayName(llGetOwner()));
    llSay(0,s);
    llSetObjectName(name);
}

default
{   touch_start(integer n)
    {   uSayAsMe("Quit bugging me!");
    }
}

*I'm not seeing the behavior I expect in firestorm, so it may be a RLV only feature.

Edited by Quistess Alpha
You are about to reply to a thread that has been inactive for 127 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
×
×
  • Create New...