Jump to content

forensixpert

Resident
  • Posts

    8
  • Joined

  • Last visited

Posts posted by forensixpert

  1. I am working on a specific HUD for a collection of different items and i would like the HUD's status indicators update when a piece is attached (worn-added) and when they are detached. I have sorted the attach portion but trying to find ideas to detect when an item from the collection is detached form the avatar.

    Any hints or directions you can suggest?

    Thanks a bunch in advance

  2. On 1/31/2023 at 6:29 AM, primerib1 said:

    Tangential, but y'all know how seeing lots of literal lists make me itch 😆

    An alternative, less-memory-using way to implement your tests here:

    else if (!llSubStringIndex(msg, "DS")) {
        msg = llGetSubString(msg, 2, -1);
        vector clr;
        integer gloss;
        if (msg == "01") {
            clr = g; gloss = m;
        }
        else if (msg == "02") {
            clr = g; gloss = h;
        }
        else if (msg == "03") {
            clr = s; gloss = m;
        }
        else if (msg == "04") {
            clr = w; gloss = m;
        }
        else if (msg == "05") {
            clr = w; gloss = h;
        }
        llSetLinkPrimitiveParamsFast(tp, [PRIM_SPECULAR, face, st, r, o, rot, clr, gloss, e]);
        // If no more possible processing
        return; 
    }
    

    Memory saving:

    • 1 list (as opposed to 5)
    • 3 func calls (as opposed to 5)
    • At the cost of 2 temporary variables (1 vector and 1 integer)
    • Sliiiightly slower since it involves 2 func calls before the decision tree

     

     

     

    More tidy too :) Thanks

    • Like 1
  3. Hi All,

    I am relatively new to the scripting and design bit of SL. 

    What I am trying to do is to make a hud that changes the color, texture and specular  of an item, user is wearing. I am using something like this;

    integer channel = 00000;                                    // THE CHANNEL NUMBER ITEM IS LISTENING TO
    
    integer tp      = LINK_THIS;                                // (TP = TargetPrim)
    integer face    = ALL_SIDES;                                // This dress has  two faces but we want them both to change
    vector r        = <1.0, 1.0, 0.0>;                          // repeat
    vector o        = <0.0, 0.0, 0.0>;                          // offset
    float rot       = 0.0;                                      // rotation
    vector w    	= <1.000, 1.000, 1.000>;                    // color white
    vector s   		= <0.749, 0.749, 0.749>;                    // color silver
    vector g     	= <0.502, 0.502, 0.502>;                    // color grey
    integer m       = 51;                                       // medium glosiness
    integer h       = 71;                                       // high glosiness
    integer e       = 0;                                        // environment
    
    string st       = "a1a1a1a1-b1b1-c1c1-d1d1-e1e1e1e1e1e1";   // UUID of the specular texture (ST = SpecularTexture)
    
    default
    {
        state_entry()
        {
        llListen(channel,"",NULL_KEY,"");
        }
    
        listen(integer channel, string name, key id, string msg)
        {
        if (llGetOwner() == llGetOwnerKey(id))
            
            // ************* RESPOND TO TEXTURE CHANGE REQUEST
            
            if (msg == "DT1" )
            {
            llSetLinkPrimitiveParamsFast(tp,[ PRIM_TEXTURE, face, "0000000-0000-0000-0000-000000000", r, o, rot]);
            llSetLinkPrimitiveParamsFast(tp,[ PRIM_NORMAL, face, "0000000-0000-0000-0000-000000000", r, o, rot]);
            llSetLinkPrimitiveParamsFast(tp,[ PRIM_SPECULAR, face, "0000000-0000-0000-0000-000000000", r, o, rot, w, m, e]);

    However, as you might appreciate I am using different specular maps for each diffuse texture. And currently I am only able to use the string, defined as st (as shown above). IS there any way I can pull the current specular texture so I can play with it's colors and shine levels? Below are the lines to set the shine options for the worn item (they also run under the same script)

    // ************* RESPOND TO SHINE LEVEL CHANGE REQUEST
            
            else if (msg == "DS01" )
            {
            llSetLinkPrimitiveParamsFast(tp,[ PRIM_SPECULAR, face, st, r, o, rot, g, m, e]);
            }
            else if (msg == "DS02" )
            {
            llSetLinkPrimitiveParamsFast(tp,[ PRIM_SPECULAR, face, st, r, o, rot, g, h, e]);
            }
            else if (msg == "DS03" )
            {
            llSetLinkPrimitiveParamsFast(tp,[ PRIM_SPECULAR, face, st, r, o, rot, s, m, e]);
            }
            else if (msg == "DS04" )
            {
            llSetLinkPrimitiveParamsFast(tp,[ PRIM_SPECULAR, face, st, r, o, rot, w, m, e]);
            }
            else if (msg == "DS05" )
            {
            llSetLinkPrimitiveParamsFast(tp,[ PRIM_SPECULAR, face, st, r, o, rot, w, h, e]);
            }

    Thank you so much if anybody can help and show me the way

×
×
  • Create New...