Teleport FX for those embarrassing TP delays

Creating scripts
Post Reply
User avatar
Sherrie Melody
Posts: 273
Joined: Fri Mar 29, 2013 6:56 pm
Has thanked: 201 times
Been thanked: 159 times

Teleport FX for those embarrassing TP delays

Post by Sherrie Melody »

You know those delays that happen when you click to teleport to a world (after you have already said your goodbyes of course), but the world is taking a few minutes to start? Well, Dot asked if I could make a TP effects thing. When you use it, just before or right after you click to teleport to that offline world, you turn this thing on, and a column of colorful glowy lights (just a texture) swirls around you until you TP away. It's just an indicator to others that you are in-progress of teleport, helps minimize those awkward moments :D

You can make your own from these scripts. You'll make two prims: 1 for the button to attach to your HUD. 1 for the cylinder that surrounds you and displays the TP effects. You can make you own version of the prims, in whatever shapes and textures you like. To make a set, like I have:

Make the HUD button:
1. rez a cube prim, and make it about X= 0.07, Y=0.07, Z=0.5
2. Name the cube "tpFX-HUD button". This is important, cause the cylinder (below) will only listen to the button if it has that name.
3. Put this texture on the cube:
tpFx_btn_texture.png
Make the cylinder:
1. Rez a cylinder, and make it about X= 1.0, Y=1.0, Z=3.0 (adjust the size so that it nicely surrounds you). Make it hollow and phantom.
2. Name the cylinder something like tpFX, just so you know what it is later in your inventory.
2. Set all sides to the default transparent texture, and then put this texture on the outside face of the cylinder (face 1). It's actually mostly transparent, though hard to tell here:
tpFx_texture2.png
Add this script to the HUD button:

Code: Select all

//tpFX HUD button script, use as you like
//Created by Sherrie
integer channel=-29388287849;
integer ON=0;
default
{
    state_entry() {
        ON=0;
        llSetColor(<0.2,0.2,0.2>, ALL_SIDES);   
    }
    touch_start(integer num_detected) {
        if(ON) {
            llRegionSay(channel, "OFF");
            llSetColor(<0.2,0.2,0.2>, ALL_SIDES);
            ON=0;
        }
        else {
            llRegionSay(channel, "ON");
            llSetColor(<1.0,1.0,1.0>, ALL_SIDES);
            ON=1;
        }  
    }
    changed(integer change) {
        if(change & CHANGED_REGION) {
            if(ON) {
                llSetColor(<0.2,0.2,0.2>, ALL_SIDES);
                ON=0;
            }    
        }   
    }
}
Add this script to the cylinder:

Code: Select all

//tpFX prim that's worn script, use as you like
//Created by Sherrie (except, I found the pulsing glow functionality here http://quiteoh.wordpress.com/quite-ohs-lsl-snippets/)
integer channel=-29388287849;
// Glow parameters
float   gGlow                   = 0.10;
float   gGlowTop                = 0.50;
float   gGlowBottom             = 0.05;
float   gGlowIncrement          = 0.05;

// Pulse parameters 0 for decrement, 1 for increment
integer gPulseDirection         = 0;
float gPulseSpeed            = .05;

integer ON=0;
key owner;
FXon() {
  llSetAlpha(0.48, 1);
  llTargetOmega(<0.0,0.0,1.0>,3.1, 0.1); 
   
}

FXoff() {
   llSetAlpha(0.0, 1);
   llTargetOmega(<0.0,0.0,0.0>,0.0,0.00); 
   llSetPrimitiveParams([PRIM_GLOW, 1, 0.0]);
}

default
{
    state_entry() {
       FXoff();
        llListen(channel, "tpFX-HUD button", "", "");
        owner = llGetOwner();
    }
    listen(integer channel, string name, key id, string message)
    {
        if(owner == llGetOwnerKey(id)) {
            if(message=="ON") {
                FXon();
                ON=1;
                llSetTimerEvent(gPulseSpeed);
            }
            else if(message=="OFF") {
                FXoff();
                ON=0;
                llSetTimerEvent(0.0);
            }
       }
    }
    // Pulse the glow
    timer()
    {
        // Glow: increment up, and down (like it's pulsing)
        if (gGlow >= gGlowTop) {
            gPulseDirection = 0;
        }
        if (gGlow <= gGlowBottom) {
            gPulseDirection = 1;
        }
        if ( gPulseDirection ) {
            gGlow += gGlowIncrement;
        }  else {
            gGlow -= gGlowIncrement;
        }
        llSetPrimitiveParams([PRIM_GLOW, 1, gGlow]);
    }
    changed(integer change) {
        if(change & CHANGED_REGION) {
            if(ON) {
                FXoff();
                llSetTimerEvent(0.0);
            }    
        }   
    }
}
Then:
1. Take the HUD button into inventory.
2. Take the cylinder prim into inventory.
3. Attach the HUD button to your HUD where you like. I put it at the bottom right. You may have to right-click and Edit, to position it better on your screen.
4. Wear the cylinder.

To use it, just touch the button to turn it on. Touch it again to turn it off. It turns off automatically after teleporting to a different world.
I found that sometimes when you turn it off, the glow effect sticks around even though the texture's totally transparent. Turn it on/off once or twice and it usually corrects itself.

Enjoy! Make your own much improved versions!
These users thanked the author Sherrie Melody for the post (total 6):
Marstol NitelyIlan TochnerConstance PeregrineDot MatrixMin TigerpawNora Eden
Post Reply