Jump to content

Make object flash while wearer types in chat?


Electra Deluxe
 Share

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

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

Recommended Posts

I've been trying to build an old-school robot avatar with bits that light up while the wearer is typing a message in chat, like the effect when the classic Robot in Lost in Space was talking. I've scoured the internet and I swear I can't find a good example of how to make this happen. I'd even buy such a script from the marketplace but either I haven't come up with the right key words or nobody sells it. Is there anyone here who can take pity on me?

Link to comment
Share on other sites

the command, I believe, that you want is llGetAgentInfo and you test the return for AGENT_TYPING. I've never built a "typer" but I assume that the method is to put the test in fairly fast timer and trigger the effects you are wanting when the avatar is detected to be typing and stop when not.  If I'm mistaken I'm sure someone will pipe up :)

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

21 hours ago, Anna Salyx said:

the command, I believe, that you want is llGetAgentInfo and you test the return for AGENT_TYPING. I've never built a "typer" but I assume that the method is to put the test in fairly fast timer and trigger the effects you are wanting when the avatar is detected to be typing and stop when not.  If I'm mistaken I'm sure someone will pipe up :)

That's the basic idea, though sometimes regions get stuck as to the state of an agent. You could try adding a double check to listen for whenever an agent says something to trigger a stop. You also don't need a horrendously fast timer. 0.5 seconds should be easily enough.

(Of course, the stuck AGENT_TYPING status could also be fixed, but ya know, deal with what you've got, not what you want.)

Edited by Toothless Draegonne
  • Thanks 1
Link to comment
Share on other sites

I think a better effect is obtained by reacting to the listen event; with llGetAgentInfo you'll trigger the flashing while you're typing, correcting, changing your mind, answering your phone and then retyping. Also, in reacting to the listen, you can modulate the flash rate depending on something like the length of the words.

As Christmas is on the horizon, here's a very crude and basic script that does that:

float letter_time = 0.02;
float space_time = 0.1;

default
{
    state_entry ()
    {
        llListen (PUBLIC_CHANNEL, "", llGetOwner (), "");
    }

    listen (integer channel, string name, key id, string message)
    {
        list words = llParseString2List (message, [" "], []);
        integer count = llGetListLength (words);
        integer counter;
        do
        {
            llSetLinkPrimitiveParamsFast (LINK_THIS, [PRIM_FULLBRIGHT, ALL_SIDES, TRUE]);
            llSleep ((float) llStringLength (llList2String (words, counter)) * letter_time);
            llSetLinkPrimitiveParamsFast (LINK_THIS, [PRIM_FULLBRIGHT, ALL_SIDES, FALSE]);
            llSleep (space_time);
        }
        while (++counter < count);
    }
}

 

  • Thanks 1
Link to comment
Share on other sites

On 11/14/2022 at 10:36 PM, KT Kingsley said:

I think a better effect is obtained by reacting to the listen event; with llGetAgentInfo you'll trigger the flashing while you're typing, correcting, changing your mind, answering your phone and then retyping. Also, in reacting to the listen, you can modulate the flash rate depending on something like the length of the words.

As Christmas is on the horizon, here's a very crude and basic script that does that:

float letter_time = 0.02;
float space_time = 0.1;

default
{
    state_entry ()
    {
        llListen (PUBLIC_CHANNEL, "", llGetOwner (), "");
    }

    listen (integer channel, string name, key id, string message)
    {
        list words = llParseString2List (message, [" "], []);
        integer count = llGetListLength (words);
        integer counter;
        do
        {
            llSetLinkPrimitiveParamsFast (LINK_THIS, [PRIM_FULLBRIGHT, ALL_SIDES, TRUE]);
            llSleep ((float) llStringLength (llList2String (words, counter)) * letter_time);
            llSetLinkPrimitiveParamsFast (LINK_THIS, [PRIM_FULLBRIGHT, ALL_SIDES, FALSE]);
            llSleep (space_time);
        }
        while (++counter < count);
    }
}

 

OMG thank you so much, KT! The next time I get to log into SL I am going to try this right away!

Link to comment
Share on other sites

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