Change font size
It is currently Wed Aug 15, 2018 1:18 pm

Forum rules


{L_IMAGE}



Post a new topicPost a reply Page 1 of 2   [ 17 posts ]
Go to page 1, 2  Next
Author Message
 Post subject: OS_Teleport(Touch & Collision) to Single Target Destination
PostPosted: Wed Nov 25, 2009 6:30 pm 
OSG Elite
User avatar

Joined: Wed Mar 11, 2009 3:57 pm
Posts: 444
Hi Again Folks.
Here is a Simple, Quick Point to Point TP which can Teleport you to In-World or HyperGrid Location depending on the DESTINATION ADDRESS you set. It Can use Touch and/or Collision to Transport an avatar. YES, You Read that Right, COLLISION ! There is a Debouncer / Damper in it to prevent Multiple TP events should they occur and I have tested this through the day with no ill effects using "collision_start".

This Script uses osTeleportAgent which must be enabled in your OpenSim.ini
Under the [XEngine] Section the following must be set to enable it.
AllowOSFunctions = true
Allow_osTeleportAgent = true


Further Information on osFunctions and Enabling Them can be found @
http://opensimulator.org/wiki/OSSL_Enabling_Functions
Reference: http://opensimulator.org/wiki/Scripting_Documentation

{L_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 = "LBSA Plaza";   // your target destination here (SEE NEXT LINES) Can Be
vector LandingPoint = <128,128,50>;     // 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 );
    }
}

_________________
No further support of any kind, for any of my materials. Use as/is whereis.
PLEASE UNSTICKY Any Stickied Posting by myself.


Last edited by WhiteStar Magic on Sat Nov 28, 2009 1:09 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: OS_Teleport(Touch & Collision) to Single Target Destination
PostPosted: Fri Nov 27, 2009 12:26 pm 
User avatar

Joined: Sun Sep 27, 2009 11:58 pm
Posts: 12
Thanks, a very nice script :)

But I had to exchange the very last line in the script:

{L_CODE}:
        PerformTeleport( agent );
with
{L_CODE}:
        if(CollideTeleport) PerformTeleport( agent );


Top
 Profile  
 
 Post subject: Re: OS_Teleport(Touch & Collision) to Single Target Destination
PostPosted: Fri Nov 27, 2009 12:27 pm 
Furious Typer

Joined: Mon Dec 08, 2008 1:04 pm
Posts: 118
You Rock WhiteStar!!

Thank you so much for for this. I did however comment out line 50
{L_CODE}:
llInstantMessage(AgentToTP, "Teleporting you to : "+Destination);


Seems there was a momentary pause when colliding. (no clue why) After commenting this line out....boom instant teleport.

Check is in the mail haha!


Top
 Profile  
 
 Post subject: Re: OS_Teleport(Touch & Collision) to Single Target Destination
PostPosted: Fri Nov 27, 2009 5:04 pm 
Site Admin
User avatar

Joined: Wed Jul 16, 2008 7:22 pm
Posts: 186
Michael Skelito {L_WROTE}:
I did however comment out line 50
{L_CODE}:
llInstantMessage(AgentToTP, "Teleporting you to : "+Destination);


Seems there was a momentary pause when colliding. (no clue why)


To maintain script behavior compatibility with Second Life, llInstantMessage() imposes a two-second delay on the script (unless you change the ScriptDelayFactor setting in OpenSim.ini).


Top
 Profile  
 
 Post subject: Re: OS_Teleport(Touch & Collision) to Single Target Destination
PostPosted: Fri Nov 27, 2009 8:55 pm 
Furious Typer

Joined: Mon Dec 08, 2008 1:04 pm
Posts: 118
Thanks Warin, the two-second delay does explain it for me.


Top
 Profile  
 
 Post subject: Re: OS_Teleport(Touch & Collision) to Single Target Destination
PostPosted: Sat Nov 28, 2009 1:06 am 
OSG Elite
User avatar

Joined: Wed Mar 11, 2009 3:57 pm
Posts: 444
phacelia Furse {L_WROTE}:
Thanks, a very nice script :)
{L_CODE}:
        if(CollideTeleport) PerformTeleport( agent );


Good Point! I whipped this up fast as a request from Skelito and trying to do 12 other things at once.

@ Skelito, I put the llInstantMessage in there to warn people about where they are going, I forgot about the 2 second delay, I don't have that on my test site... ;)

_________________
No further support of any kind, for any of my materials. Use as/is whereis.
PLEASE UNSTICKY Any Stickied Posting by myself.


Top
 Profile  
 
 Post subject: Re: OS_Teleport(Touch & Collision) to Single Target Destination
PostPosted: Sat Nov 28, 2009 8:41 am 
Furious Typer

Joined: Mon Dec 08, 2008 1:04 pm
Posts: 118
Once again, Thanks WhiteStar, but I have a silly question. Whats the difference between
if(CollideTeleport) PerformTeleport( agent ); over PerformTeleport( agent );

After testing both out, I ended up with PerformTeleport( agent ); for some reason seems to be smoother.

Just wondering 8-)


Top
 Profile  
 
 Post subject: Re: OS_Teleport(Touch & Collision) to Single Target Destination
PostPosted: Sat Nov 28, 2009 9:16 am 
User avatar

Joined: Sun Sep 27, 2009 11:58 pm
Posts: 12
Michael Skelito {L_WROTE}:
Once again, Thanks WhiteStar, but I have a silly question. Whats the difference between
if(CollideTeleport) PerformTeleport( agent ); over PerformTeleport( agent );

After testing both out, I ended up with PerformTeleport( agent ); for some reason seems to be smoother.

Just wondering 8-)


If you don't mind that I try to answer... ;p

At the top of the script you can decide whether you want the TP to happen on colliding with the object, or touching it:
{L_CODE}:
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

I wanted it to work only when clicking it, and reversed the FALSE/TRUE over. However, withouth the if-sentence, it always TP-ed me when colliding with it, even if I had sat CollideTeleport to FALSE


Top
 Profile  
 
 Post subject: Re: OS_Teleport(Touch & Collision) to Single Target Destination
PostPosted: Sat Nov 28, 2009 10:50 am 
OSG Elite

Joined: Wed Aug 05, 2009 1:59 am
Posts: 417
A very usefull script! Thanks Whitestar.


Top
 Profile  
 
 Post subject: Re: OS_Teleport(Touch & Collision) to Single Target Destination
PostPosted: Sat Nov 28, 2009 11:36 am 
OSG Elite
User avatar

Joined: Wed Mar 11, 2009 3:57 pm
Posts: 444
@ Skelito, The question was answered by phacelia Furse. I just forgot the conditional, as I was overly Multi-asking.
@ Oddball, your welcome.

There are several other Teleport Systems in here. Warin has posted a few, so have I, each with different abilities and methods. There are many applications where a collision TP is useful but here is a Word of Warning & Caution ! osTeleportAgent CAN be abused ! My Recommendations are as Follows:
  • IF you are the SOLE OWNER of the Instance (Server Operator and no other residents) you can set Allow_osTeleportAgent = true , PROVIDED that no one else can drop scripts in your region(s).
  • IF you allow others to Build & Run scripts (Including Residents on Parcels) within the Instance, you can set Allow_osTeleportAgent = UUID, UUID Where these are the UUID's of the People YOU Trust NOT to abuse this function.

This function, while Powerful CAN be used to Hi-Jack people and be used in a malicious manner by redirecting folks unwittingly to another area, region or even Grid . Therefore it calls for CAUTION & AWARENESS on the part of the System Operator.

_________________
No further support of any kind, for any of my materials. Use as/is whereis.
PLEASE UNSTICKY Any Stickied Posting by myself.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 2   [ 17 posts ]
Go to page 1, 2  Next


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of Gamexe.net