Jump to content

Delmar Quintessa

Resident
  • Posts

    18
  • Joined

  • Last visited

Posts posted by Delmar Quintessa

  1. integer door = FALSE;
    
    open ()
    {
        llSetPrimitiveParams([ PRIM_SIZE, <0.010, 0.010, 1.703> ]);
    }
    
    close ()
    {
        llSetPrimitiveParams([ PRIM_SIZE, <0.010, 1.761, 1.703> ]);
    }
    
    default
    {
        state_entry()
        {
            close();
        }
    
        touch_start(integer total_number)
        {
            if(door == TRUE)
            {
                door = FALSE;
                close ();
                return;
            }
            else
            {
                 door = TRUE;
                 open ();
                 return;
            }
        }
    }

    Hello-  I have this script, but would like for the door to remain closed when rezzed despite it being taken into inventory with the doors open.  I thought that's what the script was supposed to do but maybe I'm missing a line of code?  I changed Integer door to TRUE (at the very top) just to check, but it doesn't seem to make a difference.

  2. Thank you Prof and Rolig for your replies, participation and even logging in.  Next time, I will make a new post, now that I know :) .  I didn't expect a deep dive, and sadly, I'm drowning 🥴 welp.  It's a lot of information, for sure.  The go to color picker I use I've had for years, surprisingly it's still on MP https://marketplace.secondlife.com/p/Bjorns-HSL-Color-Picker-1-prim/240995 a fp freebie.  There's a few parts to this which I didn't think relevant ("simply add the line of code proved to be not that simple" ha).  So one script sets primitive parameters cutting and texturing.  I was tempted to insert that script here as well but I seem to be taking up a lot of screen space but can do if requested/needed...  the other 2 scripts are the hsl picker that tells the listening script what to change to.  

    Prof, I believe the reason for the 2 touch events (I think that's what you meant as far as multiple states earlier?) is because the color picker has the hsl picker on one face(has the sl color picker texture on it), and hue saturation on another face.  From what I'm understanding, I'd need to add the check detected key owner on both events, that was my original thought as well when attempting to add the owner only code. I'm realizing that when trying to "research" I was looking at aides that consisted of one state, duhr on me.  I'll try again, as that's what prompted the syntax errors pointing to the second touch event which led me down a rabbit hole of "tweaking the script" so back to the drawing board it is.

    Rolig, thats pretty cool!  Sadly it doesnt match up with my current hsl and hue texture surely because I'm missing whichever texture you're using so on my end once clicking on it it gives me random sequences of color not corresponding to the current "sl color picker" and "hue" textures (c38e5a0b-fb82-a576-59fe-b885961e300c & 79e7df6f-92e2-1fca-5c86-e60fa132c071).  As far as the chat is concerned, I don't receive any chat except when I changed the channel to 0 as Prof suggested earlier to see what users were clicking and aid in debugging, once tested, I changed it back to channel 1024 (which was for the listening prim/s).

    I also happened to notice I have another color picker that you helped put together as well! ha.  That one is way more advanced than this one, and I am absolutely in love with it!  Sadly, due to it's prim count I wasn't able to use it as I'm trying to have users color change on multiple channels.  So in theory, I'd need multiple color pickers rezzed increasing the land impact significantly.

  3. My apologies, excuse my lack of forum decorum :) didn't mean to ruffle any feathers, feel free to mutter and thank you for not booting me! I have multiple ones up, including one from 2 years ago (the most recent I saw), and this one is the last one I was reading, and thought it was more closer to my specific issue.  Regarding the debugging in local chat, it returns the object name and the HSL of the color selected on the color picker prim.  

    Attaching a clip of the original script

    default
    {
        state_entry()
        {   //Initial color
            //new_hsl_color(HSL);
        }
    
        touch_start(integer n)
        {
            integer face = llDetectedTouchFace(0);
            if(face == HS_PLANE_FACE)
            {   //HS plane
                vector v = llDetectedTouchST(0);
                HSL = <v.y, 1.0 - v.x, HSL.z>;
                
                new_hsl_color(HSL);
            }
            else if(face == L_AXIS_FACE)
            {   //L axis
                vector v = llDetectedTouchST(0);
                HSL = <HSL.x, HSL.y, v.y>;
                
                new_hsl_color(HSL);
            }
            else if(face == -1)
            {   //TOUCH_INVALID_FACE ~ outdated viewer
                llInstantMessage(llDetectedKey(0), "Please update your viewer to use this color picker :P");
            }
        }
    
        touch(integer n)
        {
            integer face = llDetectedTouchFace(0);
            if(face == HS_PLANE_FACE)
            {   //HS plane
                vector v = llDetectedTouchST(0);
                HSL = <v.y, 1.0 - v.x, HSL.z>;
                
                new_hsl_color(HSL);
            }
            else if(face == L_AXIS_FACE)
            {   //L axis
                vector v = llDetectedTouchST(0);
                HSL = <HSL.x, HSL.y, v.x>;
                
                new_hsl_color(HSL);
            }
        }
    }

    The numerous posts I've read said to simply add llDetectedKey and llGetOwner, as well as the wiki, (the videos I watched corresponded to Listen which aren't in the color picker script.)  However, when doing so I would receive an error regarding the touch (integer n).  Trying to find a fix I changed it to touch_end (integer n) which removed the error, but did nothing for restricting the script to owner only.  But, yeah I even tried it on the actual object receiving prim since that does have a listening but that didn't seem right either. That script with how I attempted to add the llGetOwner is below

    integer CMD_CH = -1024;

    default
    {
        state_entry()
        {
            llListen(CMD_CH, "", "", "");
        }
        
        listen(integer ch, string name, key id, string msg)
        {
            if (llDetectedKey(0) == llGetOwner())
            {
            llSetColor((vector)msg, ALL_SIDES);
            }
        }
    }

    if (llDetectedKey(0) == llGetOwner()){
    if (llDetectedKey(0) == llGetOwner())
        {
  4. Hai all-  I'm tweaking away at a color picker and thought I successfully added " if (llDetectedKey(0) == llGetOwner()) " as I would like this to be owner use only (its to be used rezzed, not as a HUD).  I got so many errors with the original touch_ (integer n) lines I decided to make it more specific with a touch_start and touch_end , and that seems resolved now, no errors.  I'm testing and I'm definitely missing something I'm not seeing as others are able to interact with it.  It's tricky for me as this is a (integer n) as oppose as to a listen script which IMO are easier, but not what I need, lol.  Anyways. I'm not sure if it's my bracket count?  I'd appreciate any feedback!

    integer HS_PLANE_FACE = 2;
    integer L_AXIS_FACE = 4;
    integer CMD_CH  = -1024;
    vector HSL = <0.0, 0.0, 0.5>;
    
    
    //Set new color and (optionally) preview
    new_hsl_color(vector color)
    {
        //llSetColor(hsl_2_rgb(<color.x, color.y, 0.5>), L_AXIS_FACE);
        llSay(CMD_CH, (string)hsl_2_rgb(color));
        llSleep(0.1);
    }
    
    //Wrap value to between 0 and 1
    float scale_f(float f)
    {
        if (f < 0.0)
        {
            f += 1.0;
        }
        else if(f > 1.0)
        {
            f -= 1.0;
        }
        
        return f;
    }
    
    //Calculate RGB from (t, p, q)
    float rgb_color(float c, float p, float q)
    {
        if(c < 0.166667)
        {
            return p+(q-p)*6*c;
        }
        else if(c >= 0.166667 && c < 0.5)
        {
            return q;
        }
        else if(c >= 0.5 && c < 0.666667)
        {
            return p+(q-p)*6*(0.666667 - c);
        }
        else
        {
            return p;
        }
    }
    
    //Convert HSL color to RGB color
    vector hsl_2_rgb(vector color)
    {
        float p;
        float q;
        vector t = <scale_f(color.x + 0.333333), scale_f(color.x), scale_f(color.x - 0.333333)>;
        
        if (HSL.z < 0.5)
        {
            q = color.z * (1 + color.y);
        }
        else
        {
            q = color.z + color.y - (color.z * color.y);
        }
        
        p = 2*color.z - q;
        
        return <rgb_color(t.x, p, q), rgb_color(t.y, p, q), rgb_color(t.z, p, q)>;
    }
    
    integer touched;  
     
    default
    {
        state_entry()
        {   //Initial Color
            //new_hsl_color(HSL);
        }
    
        touch_start(integer n){
             if (llDetectedKey(0) == llGetOwner()){
              touched = FALSE;
             integer face = llDetectedTouchFace(0);
            if(face == HS_PLANE_FACE)
            {   //HS plane
                vector v = llDetectedTouchST(0);
                HSL = <v.y, 1.0 - v.x, HSL.z>;
                
                new_hsl_color(HSL);
            }
            else if(face == L_AXIS_FACE)
            {   //L axis
                vector v = llDetectedTouchST(0);
                HSL = <HSL.x, HSL.y, v.y>;
                
                new_hsl_color(HSL);
            }
        }
           
            llResetTime();
        }    
     
        touch_end(integer n)
        {
            integer face = llDetectedTouchFace(0);
            if(face == HS_PLANE_FACE)
            {   //HS plane
                vector v = llDetectedTouchST(0);
                HSL = <v.y, 1.0 - v.x, HSL.z>;
                
                new_hsl_color(HSL);
            }
            else if(face == L_AXIS_FACE)
            {   //L axis
                vector v = llDetectedTouchST(0);
                HSL = <HSL.x, HSL.y, v.x>;
                
                new_hsl_color(HSL);
            }
        }
    }

     

×
×
  • Create New...