Lolita Erin Posted March 5, 2015 Share Posted March 5, 2015 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 More sharing options...
Xiija Posted March 5, 2015 Share Posted March 5, 2015 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 More sharing options...
Dora Gustafson Posted March 5, 2015 Share Posted March 5, 2015 It will probably be easier to change the prim dimension on the axis it is pressed :smileysurprised::smileyvery-happy: Link to comment Share on other sites More sharing options...
Rolig Loon Posted March 5, 2015 Share Posted March 5, 2015 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 More sharing options...
Lolita Erin Posted March 5, 2015 Author Share Posted March 5, 2015 Thank you that was what i need it !!! Link to comment Share on other sites More sharing options...
Lolita Erin Posted March 5, 2015 Author Share Posted March 5, 2015 other question, what happend if the user get the board to inventory and some buttons are press? next time the rezz they will press more right? Link to comment Share on other sites More sharing options...
Rolig Loon Posted March 5, 2015 Share Posted March 5, 2015 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 More sharing options...
Lolita Erin Posted March 5, 2015 Author Share Posted March 5, 2015 ok thank you so much!!! Link to comment Share on other sites More sharing options...
Recommended Posts
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