Jump to content

Contact -> Prim Texture Change


Subsonic Oh
 Share

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

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

Recommended Posts

Hey, I know I'm old, but still a noob when it comes to scripts.

I have made a script which is playing sound on contact, and I have a script which is changing texture (glow on -> transparancy off -> glow on) on touch. But i can't combine both.

What I want to do:

A floor, invisible hexagons on the ground. Each prim should have a script inside to make the hexagon people are walking on visible (transparancy off/glow on) and after like 1 sec it should become invisible again. Damn this is a noob script, but too much for me lol

Would really appreciate help on this ♥

Link to comment
Share on other sites

Maybe too basic, but basically you want to take the code that changes the texture (which will likely be found in the touch_start event) from one script and use that to replace the code that plays the sound (which will likely be found in the collision_start event) in the other script. When you change the texture you will want to start a timer, and in the timer event you'll stop the timer and change the texture back again.

Something like this (I'm guessing that the texture change script uses llSetLinkPrimitiveParamsFast):

default
{
    collision_start (integer count)
    {
//        llPlaySound ("My sound", 1.0); //not needed here, so commented out
        llSetLinkPrimitiveParamsFast (...stuff to do the glow and transparency);
        llSetTimerEvent (1.0);
    }

    timer ()
    {
        llSetTimerEvent (0.0);
        llSetLinkPrimitiveParamsFast (...stuff to undo the glow and transparency);
    }
}

Feel free to ask more questions if you need to.

Edited by KT Kingsley
a few less words
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Thank you so much, here's the working result:

Quote

default
{
    collision_start (integer count)
    {
        llSetAlpha(100,ALL_SIDES);
        llSetPrimitiveParams([ PRIM_GLOW, ALL_SIDES, 0.4 ]);
        llSetTimerEvent (1.0);
    }

    timer ()
    {
        llSetTimerEvent (0.0);
        llSetAlpha(0,ALL_SIDES);
        llSetPrimitiveParams([ PRIM_GLOW, ALL_SIDES, 0.0 ]);
    }
}

 

Link to comment
Share on other sites

A pedantic detail regarding alpha values: in the edit window it's measured as percentage transparency, while script functions use your actual alpha, which is a measure of opacity, and measured 0.0 to 1.0. Different scales, and the other way around.

Where you use the value 100, you should be looking at 1.0. Fortunately the script engine can cope.

  • Thanks 1
Link to comment
Share on other sites

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