Jump to content

Lightning flashing script help?


siennasprout
 Share

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

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

Recommended Posts

I got this cool antenna that randomly flashes between textures every few seconds, but it gives off light and this is a problem for some of my photosensitive friends. Unfortunately the script isn't modify.

This is what it looks like in action and this is the stuff inside. Instead of playing a single animated texture, it randomly picks 2 textures from inside and plays them with a buzzing sound every few seconds.

Is there a way to script this without having it emit light?

 

 

ezgif-2-7999213d95d9.gif

Capture.PNG

Link to comment
Share on other sites

Almost certainly, but that script is no-mod, so you can't do it.  You'll have to replace that script with a new one that does not include a flashing light (assuming that your object itself can be modified).  This example is dirt simple (no on/off switch, nothing fancy).  It just flashes a random texture on face 1 of your object every few seconds and makes a sound.  Put the script and  your textures and sound in your object.

default
{
    state_entry()
    {
        llSetTimerEvent(0.1);
    }

    timer()
    {
        llSetTimerEvent(5.0 + llFrand(10.0));   // This will make a lightning texture show randomly every 5 to 15 seconds
        integer iPickOne = (integer)llFrand(4.0);
        llSetTexture( llGetInventoryName(INVENTORY_TEXTURE,iPickOne), 1);    // Display random texture on Face 1
        llSetAlpha(1.0, 1);   //Make Face 1 visible
        llPlaySound("electric14",1.0);
        llSleep(1.0);
        llSetAlpha(0.0,1);    //Make face 1 transparent
    }
}

No guarantees.  Just off the top of my head, but it ought to work.  I have no Idea which face of your object is supposed to have the lightning texture on it, so I am guessing that it's face #1.  The only way you will know is to try it -- on a fresh backup copy of your object.  If I guessed the wrong face, change face 1 in the script to something else between 0 and 7 and try again on a fresh copy.  If it really doesn't work -- because maybe your object has more than one link -- then it's a real crap shoot and you'll just be stuck with what you have now.

Edited by Rolig Loon
Link to comment
Share on other sites

On 1/24/2021 at 7:29 PM, Rolig Loon said:

Almost certainly, but that script is no-mod, so you can't do it.  You'll have to replace that script with a new one that does not include a flashing light (assuming that your object itself can be modified).  This example is dirt simple (no on/off switch, nothing fancy).  It just flashes a random texture on face 1 of your object every few seconds and makes a sound.  Put the script and  your textures and sound in your object.


default
{
    state_entry()
    {
        llSetTimerEvent(0.1);
    }

    timer()
    {
        llSetTimerEvent(5.0 + llFrand(10.0));   // This will make a lightning texture show randomly every 5 to 15 seconds
        integer iPickOne = (integer)llFrand(4.0);
        llSetTexture( llGetInventoryName(INVENTORY_TEXTURE,iPickOne), 1);    // Display random texture on Face 1
        llSetAlpha(1.0, 1);   //Make Face 1 visible
        llPlaySound("electric14",1.0);
        llSleep(1.0);
        llSetAlpha(0.0,1);    //Make face 1 transparent
    }
}

No guarantees.  Just off the top of my head, but it ought to work.  I have no Idea which face of your object is supposed to have the lightning texture on it, so I am guessing that it's face #1.  The only way you will know is to try it -- on a fresh backup copy of your object.  If I guessed the wrong face, change face 1 in the script to something else between 0 and 7 and try again on a fresh copy.  If it really doesn't work -- because maybe your object has more than one link -- then it's a real crap shoot and you'll just be stuck with what you have now.

The script works, but unfortunately I need the texture to flash on both sides. Also between the flashes there shouldn't be anything visible at all. The lightning and sound should only play every few seconds with quiet + total transparency inbetween. While the texture shows up, it's on the wrong face, and I'm not sure how to display it on both faces. Another thing that was different about the original script is that it played two random textures for every flash. Your script plays one, which works perfectly fine, but if there's a way to script it as close as possible to the original no mod script, it would be really appreciated. Thank you for taking the time to help in the first place by the way! Your posts on here have been total lifesavers. :)

Link to comment
Share on other sites

The only way to mimic the original exactly is to have the model itself, so you can see what it does (which faces change, which textures appear and for how long, etc).  You have the model, of course, so you can do that.  You also have my mock-up script example, so you have the general idea of how to proceed.  At this point, you can either try experimenting by yourself to see what happens when you make a few tiny changes, or you can find a friend who can tweak it for you.  

Link to comment
Share on other sites

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