Jump to content

Press Button efect


Lolita Erin
 Share

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

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

Recommended Posts

Hello i am trying to make a panel control with couple buttons this is a Main Prim and 4 Linked prims (the buttons) i was wondering how can i acomplish and Effect to press the button (and keep it press until press again), i belive i have to move the linked prim and when press again move it to original position, is there any simple script to do this? thank for any help

Link to comment
Share on other sites

you need to get each link's local position, then set it and toggle the change...

 something like this.....? ( this assumes one button ... an ON button)

integer  linkNum;
vector currButton;

list paramsONbutton;
vector onButtonPos;
float ONzee = 0.05;

//add more button definitions here

default
{
    state_entry()
    {  paramsONbutton = llGetLinkPrimitiveParams(2, [PRIM_POS_LOCAL]);
       onButtonPos = llList2Vector(paramsONbutton,0);

       // add more buttons here
    }

    touch_start(integer total_number)
    {    linkNum = llDetectedLinkNumber(0);  
         if( linkNum == 2)
          { currButton = onButtonPos;
            llSetLinkPrimitiveParamsFast(linkNum,
            [ PRIM_POS_LOCAL, currButton - <0.0, 0.0, ONzee> ] );
            ONzee = -ONzee;
          }
      
        // add more link checks here
    }
}

  you will need a list , float and vector variable for each button prim,

 and IF statements for each button link number?

Link to comment
Share on other sites

You could do as Xijia suggests and use prim buttons that move up and down or you could take a very different route and swap textures on your button panel.  Make a texture that has all of your buttons on it and then make several variations that show different buttons in the Down (Pressed) position. If you have four panel buttons, for example, that means making five versions of the panel texture.  Then use llDetectedTouchST to detect which part of the textured penl a user has touched. Use llSetTexture or its llSetLinkPrimitiveParams equivalent to display the appropriate "Down button" image.  After a pause, switch back to the "Up" button image.

I have used that method very successfully on several projects.  It's fairly easy to script and it saves on prims (L.I.) in your project too.

Link to comment
Share on other sites

That all depends on how you wrote your script. When you take a scripted object to inventory, its script stops. It starts again when you rez the object from inventory, with all values exactly where you left them. If you want the script to do something different when you re-rez the object, you need to tell it that in an on_rez event. So ...

on_rez(integer startup) {     llResetScript(); /// Wipe all values and start over again}

 or

on_rez (integer startup) {     giNewTest = 0;    glResults = [];}

 

Link to comment
Share on other sites

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