Jump to content

Trying to send command to head on sit


midorimomoi
 Share

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

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

Recommended Posts

Hi,

I've been trying to make a script to reset my head setting to my defaults whenever I sit on an object with my script in it. So far here's what I managed to do:

 

integer m4_channel = -13042018;
key sitter = NULL_KEY;

default {
    changed(integer change)
    {
        if (change & CHANGED_LINK)
        {
            key avatar = llAvatarOnSitTarget();
            llListen(m4_channel, "", NULL_KEY, "");
            if (avatar != NULL_KEY && sitter == NULL_KEY)
            {
                sitter = avatar;
                llRegionSayTo(sitter, m4_channel, "M4int:LidL:1:LidR:1:Blush:3:Mouth:6:RollL:5:RollR:5");
            }
        }
    }
}

However, this script seems to only work when the owner of the object sits, and not for my other alts. I'd like to make it work for basically any avatar with the same head that sits on that object.

Not exactly sure what I'm missing here as I'm not an experienced scripter, so any help would be appreciated. Thank you.

Link to comment
Share on other sites

It's very likely that the head (made by Utilizator) is scripted to listen for commands from only the owner, making it impossible for objects owned by someone else to control the head. (This is generally a good thing, otherwise random people could distort your face when you don't want to.)

You could create your own "command relay," like a HUD that listens for commands from anyone and repeats them to the owner. (This is how RLV relays also work.) You would then give your command relay to all of your alts.

Edited by Wulfie Reanimator
  • Like 1
Link to comment
Share on other sites

34 minutes ago, Wulfie Reanimator said:

You could create your own "command relay," like a HUD that listens for commands from anyone and repeats them to the owner. (This is how RLV relays also work.) You would then give your command relay to all of your alts.

That's actually what I ended up doing. One script in the object I want to sit on that will transmit its UUID on a channel when I sit, and another script I added to my collar that listens to that same channel and only changes my head when it receives the specific UUID.

If you or anyone else is curious (or is looking for something similar), that's the script to add to your furniture:

integer dialog_channel;
key user_id;

default {
    changed(integer change) {
        if (change & CHANGED_LINK) {
            user_id = llAvatarOnSitTarget();
            if (user_id != NULL_KEY) {
                dialog_channel = (integer)("0x"+llGetSubString((string)user_id,-8,-1)) ^ 0xAAAAAAAB;
                llSay(dialog_channel, (string)llGetKey());
            }
        }
    }
}

And that's the one to be added to an object you're wearing:

integer listen_handle;
integer dialog_channel;
key user_id;
integer m4_channel = -13042018;
key furniture_key = "your furniture UUID goes here";

default {
    state_entry() {
        user_id = llGetOwner();
        dialog_channel = (integer)("0x"+llGetSubString((string)user_id,-8,-1)) ^ 0xAAAAAAAB;
        listen_handle = llListen(dialog_channel, "", NULL_KEY, "");
    }

    listen(integer channel, string name, key id, string message) {
        if (message == furniture_key) {
            llRegionSayTo(llGetOwner(), m4_channel, "M4int:LidL:1:LidR:1:Blush:3:Mouth:6:RollL:5:RollR:5");
        }
    }

    on_rez(integer start_param) {
        llResetScript();
    }
}

This works fine this way.

Edited by midorimomoi
  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 74 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...