Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Opengrid - Teleport collision
#1
Rainbow 

Wink


Code:
//XEngine;lsl
// ----------------------------------------------------------------
// Script Title:    OS_Teleport(Touch & Collision)
// Created by:      WhiteStar Magic
// Creation Date:   25/11/2009
// Platforms:
//    OpenSim:       Y, Tested and Operational on OpenSim git# f605d59 - r11575
//
// Revision:        0.3
//
// Conditions:
// Please maintain this header. If you modify the script indicate your
// revision details / enhancements
//
// Support:         NONE
//
// Licensing:       OpenSource.  Do as you will with it!
//
// ================================================================
// NOTES:
// Single Target Destination ONLY
// Alternatives are available for Multi-Desination in the OSG Forums (Scripting forum)
//
// Set Destination as described below, There are a Few Options depending on Application:
//      Destination = "1000,1000";                 = In-Grid Map XXXX,YYYY coordinates
//      Destination = "RegionName";                = In-Grid-TP to RegionName
//      Destination = "TcpIpAddr:Port:RegionName"; = HyperGrid-TP method
//      Destination = "DNSname:Port:RegionName";   = HyperGrid-TP method
//
// Set your Desired Mode for Touch AND/OR Collision
// DEFAULT = Touch OFF, Collision ON
// ========================================================================================
//
// === SET DESTINATION INFO HERE ===
string Destination = "Dest";   // your target destination here (SEE NEXT LINES) Can Be
vector LandingPoint = <128,128,0>;     // the landing point for avatar to arrive at
vector LookAt = <1,1,1>;                // which way they look at when arriving
// === SET USAGE MODES HERE ===
integer TouchTelePort = FALSE;          // set to TRUE if you want TP on Touch
integer CollideTeleport = TRUE;         // set to TRUE if you want to TP on Collision
//                                      // NOTE:  Collisions CAN be tricky in OpenSim
// ========================================================================================
//                  DO NOT MODIFY BELOW UNLESS YOU ARE CERTAIN
// ========================================================================================
list LastAgents = [];                   // retention list for de-bouncer used for Collisions
                                        // preventing Multiple Triggers from occuring
key agent;
//
PerformTeleport( key AgentToTP )
{
    llWhisper(0, "Teleporting you to : "+Destination);
  
    integer TimeNow = llGetUnixTime();
    integer a_idx = llListFindList( LastAgents, [ AgentToTP ] );
    if (a_idx != -1)
    {
        integer TimeLast = llList2Integer( LastAgents, a_idx + 1 );
        if (TimeLast >= (TimeNow - 6)) return;
        LastAgents = llDeleteSubList( LastAgents, a_idx, a_idx+1);
    }
    LastAgents += [ AgentToTP, TimeNow ];  // agent just TP'd so add to list with NOWTIME
    osTeleportAgent(AgentToTP, Destination, LandingPoint, LookAt);  
}
//============
// MAIN APP
//============
default
{
    on_rez(integer start_param)
    {
        llResetScript();
    }
    changed(integer change)     // something changed, take action
    {
        if(change & CHANGED_OWNER)
        {
            llResetScript();
        }
        else if (change & 256)  // that bit is set during a region restart
        {                      
            llResetScript();
        }
    }
  
    state_entry()
    {
        string TOUCH = "OFF";
        string COLLIDE = "OFF";
        if(TouchTelePort) TOUCH = "ON";
        if(CollideTeleport) COLLIDE = "ON";
        llOwnerSay("Teleportal Active: Collision = "+COLLIDE+" / Touch = "+TOUCH);
    }
  
    touch_start(integer num_detected)
    {
        key agent = llDetectedKey(0);
        if(TouchTelePort) PerformTeleport( agent );
    }
  
    // This is TRICKY / FLAKY  Alternates are COMMENTED here. REMOVE the first // and comment out the collision*() you wish to try
    //collision(integer num_detected)         // Triggers IMMEDIATE Response on Contact / Collision. OFTEN Causes Duplicate trigger
    //collision_end(integer num_detected)     // Will WAIT till collisions are COMPLETED,
                                              // means a DELAY till collisions stop so you have to BACK OFF the prim & collisions Stop
                                              //
    collision_start(integer num_detected)   // Immediate Response, CAN cause multiple HITS, INFREQUENTLY (WORKS BEST)
    {
        key agent = llDetectedKey(0);
        if(CollideTeleport) PerformTeleport( agent );
    }
}
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  script Opengrid - avatar key and name speaker trainz 1 1,200 12-14-2011, 05:21 AM
Last Post: Anarchist_Labs
Photo Script Opensim - Texture Carte Map trainz 1 1,225 12-14-2011, 05:18 AM
Last Post: Anarchist_Labs
Star Script OPENGRID - Paticle Fire Orange trainz 1 1,459 11-12-2011, 04:04 AM
Last Post: LordJames
  Script Opensim - Texture UUID trainz 0 1,081 11-05-2011, 08:59 PM
Last Post: trainz
Brick Script opengrid - sim info trainz 0 1,054 11-05-2011, 08:31 PM
Last Post: trainz



Users browsing this thread: 1 Guest(s)