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

Forum rules


{L_IMAGE}



Post a new topicPost a reply Page 1 of 1   [ 2 posts ]
Author Message
 Post subject: In-Grid + Teleportation System Script
PostPosted: Thu Aug 13, 2009 3:29 pm 
OSG Elite
User avatar

Joined: Wed Mar 11, 2009 3:57 pm
Posts: 444
This is an In-Grid teleportation system which uses BUTTON on a prim to grab "Target Location".
It could be used in MAP mode & osTeleportAgent mode.
If using it in osTeleportAgent mode, you could even set the addressing to use Hypergrid Addressing.
This system has a capacity of only 12 destinations and woudl require a total of 14 prims.

Here is an example of how the strings could be entered for Alternate osTeleportAgent() addressing
//string TargetAddress = "9996,9974"; // In-Grid Teleport (Grid Map Locations XXXX,YYYYY)
//string TargetAddress = "first-star.dyndns.org:9000:FirstStar_Station"; // HyperGrid Example (using DNSname:Port:RegionName)
//string TargetAddress = "98.143.155.182:9031:HyperGrid-Supply-Centre"; // Hypergrid TP are also valid (IPaddress:Port:RegionName)

This requires a Root Prim with other smaller prims named EXACTLY to match the entries in the L_RegionNames list for the buttons. The script must reside in the ROOT PRIM . An additional Prim called MENU is to be added and that will give the owner the menus to change from osTPmode, MapMode etc....
Prim 1 - ROOT PRIM in LinkSet
Prim 2 - Prim named MENU
prims 3 - 14 Destination Prims. MUST be called exactly as defined in the List.


{L_CODE}:
//XEngine:lsl
// ----------------------------------------------------------------
// Script Title:    In-Grid-Teleporter
// Created by:       WhiteStar Magic
// Creation Date:   July-07-2009
// Platforms:       OpenSim
//
// Revision:        0.02  August-10-2009
// Revision History:
// 0.01 Initial Running & operations version
// 0.02 added MultiMode info for osTeleportAgent
//
// Revision Contributors:
//  Original Code started by Warin Cascabel @ OSGrid as "Plaza Teleport System"
//
//
// Conditions:
// Please maintain this header. If you modify the script indicate your
// revision details / enhancements
//
// Support:  As Required IF Required.  Scripts are provided As-Is/Whereis
//
// Licensing:  Full OpenSource under Creative Commons 3.0
// ================================================================
// ** SCRIPT NOTES **
// ! Heavily & Extensively modified from original code.
// ! BUTTON Prims MUST bear the name of individual entries in L_RegionNames list
// ! IF you wish to use osTeleportAgent, it MUST be enabled on the region in OpenSim.ini, otherwise use MAP.
//
//================================================================
// === GLOBAL VARIABLES
//
integer TP_X_MAP = FALSE;   // set to TRUE to use MAP if osTeleportAgent is not enabled
integer MENU_mode = FALSE;  // set to TRUE to use Menu Selections
//
integer DEBUG = FALSE;  // set to TRUE for debug msgs
integer CHANNEL;        //Channel for Menus
//
// === 3 Lists, Maximum 12 entries IF using MENU_mode = TRUE
// --- Region Name Max Length is 24 characters due to MENU/llDialog Constraints, ONLY 11 Chars visible on Buttons
// --- This list serves 2 functions.
//     1) it is used to present selections available by MENU
//     2) to identify the Button Prims (WHICH MUST BE NAMED EXTACLY as presented in the list)
list L_RegionNames =
    [
    "Bade Plaza",
    "Lbsa Plaza",
    "SeaPrior Plaza",
    "Teravus Plaza",
    "Wright Plaza",
    "Zaius Plaza",
    "Metaversity Campus",
    "Sandbox Plaza"
    ];
// --- LandineZones matched sequence to region names
//      This is WHERE the Avatar is to arrive at.
//
//      OR TargetAddress  Examples
//string TargetAddress = "9996,9974";                                                      // In-Grid Teleport (Grid Map Locations XXXX,YYYYY)
//string TargetAddress = "first-star.dyndns.org:9000:FirstStar_Station";    //HyperGrid Example (using DNSname:Port:RegionName)
//string TargetAddress = "IPaddress:Port:RegionName";                            // Hypergrid TP are also valid (IPaddress:Port:RegionName)

list L_LZs = [
    <92.0,115.0,41.0>,
    <127.0,128.0,40.0>,
    <69.0,202.0,21.0>,
    <113.0,126.0,35.0>,
    <128.0,126.0,22.0>,
    <127.0,127.0,22.0>,
    <129.0,128.0,35.0>,
    <128.0,128.0,23.0>
    ];
// --- LookAt Direction for avatar arriving @ target
//      this is which way the AVATAR will face when they arrive at above position
//      ! does not affect MAP mode but is required IF using osTeleportAgent
list L_LookAts = [
    <128.0,128.0,22.0>,
    <128.0,128.0,22.0>,
    <128.0,128.0,22.0>,
    <128.0,128.0,22.0>,
    <128.0,128.0,22.0>,
    <128.0,128.0,22.0>,
    <128.0,128.0,22.0>,
    <128.0,128.0,22.0>
    ];
// ======= end of lists
//
// === MENUS === \\
OPEN_Comms()  // Open Communications Channel only when needed
{
    llListenRemove(CHANNEL);                         // SAFETY Kill CHANNEL incase left over
    CHANNEL = (integer)(llFrand(-1000.0) - 1000.0);  // RANDOM Negative Channel
    llListen(CHANNEL, "", "", "");                   // listen for dialog answers
    llSetTimerEvent(45.0); // to AutoKill CHANNEL
}
//
MENU_Main(key id) // Main OWNER Dialog Menu
{
    OPEN_Comms();
    llDialog(id, "-=[ General Teleporter Owner Config ]=-"+
        "\nMAP_Mode = use MAP for Teleporting"+
        "\nOStp_Mode = use osTeleportAgent (IF Enabled on Region)"+
        "\nMENU_Mode = Use menus instead of Touch Prims"+
        "\nRESET = Reset Script"+
        "\nMake Selection:",btn_order(["MAP_Mode", "OStp_Mode", "MENU_Mode", "RESET"]), CHANNEL);
}
//
MENU_Dest(key id) // Users Destination Menu
{
    OPEN_Comms();
    llDialog(id, "-=[ Teleporter Destination Menu ]=-"+
        "\nSelect your Destination:",btn_order(L_RegionNames), CHANNEL);
}
// === Order the Buttons into right sequence for DIALOG MENUS
list btn_order(list btns)
{
    return llList2List(btns, -3, -1) + llList2List(btns, -6, -4)
        + llList2List(btns, -9, -7) + llList2List(btns, -12, -10);
}
//
// getting destination target data
GET_dest(string DestName, key avikey)
{
    integer DestIndex = llListFindList( L_RegionNames, [ DestName ] );
    string DestString - llList2String( L_LZs, DestIndex );
    vector DestPos = llList2Vector( L_LZs, DestIndex );
    vector DestLook = llList2Vector( L_LookAts, DestIndex );
    //
    TP_agent( avikey, DestName, DestPos, DestLook );
    // !!!!!
    //IF using the alternate addressing TargetAddress list Comment above line and uncomment line below
    //TP_agent( avikey, DestString, DestPos, DestLook );
}
// Teleport agent routine. Uses either Map OR osTP(default)
TP_agent(key agnt, string Dname, vector Dpos, vector Dlook)
{
    if(TP_X_MAP) //using MAP for agent to TP to destination
    {
        llMapDestination( Dname, Dpos, Dlook );
    }
    else // we are using osTPagent
    {
        osTeleportAgent( agnt, Dname, Dpos, Dlook );
    }
}
//
// --==[ Main Script ]==--
//
default
{
    on_rez(integer start_param)
    {
        llResetScript();
    }
    state_entry()
    {
        llOwnerSay( "Agent Teleporter Online" );
    }
    changed(integer change) // something changed, take action
    {
        if(change & CHANGED_OWNER)
        {
            if (DEBUG) llOwnerSay("Owner Changed, Resetting Script");
            llResetScript();
        }
        else if (change & 256) // that bit is set during a region restart
        {
            llResetScript();
        }
    }
    //
    touch_start(integer num_detected)
    {
        if(MENU_mode) MENU_Dest(llDetectedKey(0));
        else /// grab prim number touched, get name and get data for it
        {
            while (num_detected--)
            {
                integer TouchedPrim = llDetectedLinkNumber( num_detected );
                if (TouchedPrim > 1)
                {
                    string DestName = llGetLinkName( TouchedPrim );
                    key avikey = llDetectedKey( num_detected );
                    if(DestName == "MENU") MENU_Main(avikey);   // Only for the Owner IF they hit MENU button
                    else GET_dest(DestName, avikey);            // get the destination info and send avatar on route
                }
            }
        }
    }
    //
    listen( integer channel, string name, key id, string msg )
    {
        if(DEBUG) llOwnerSay("\nListen Heard on Channel " + (string)channel+
            "\nName: "+name+
            "\nID: "+(string)id+
            "\nMSG: "+msg);
        llListenRemove(CHANNEL); // Kill Listen reduce Lag
        llSetTimerEvent(0.0);    // ZERO Timer Event
        if(id == llGetOwner())
        {
            if(msg == "RESET") llResetScript();
            else if(msg == "MAP_Mode") TP_X_MAP = TRUE;
            else if(msg == "OStp_Mode") TP_X_MAP = FALSE;
            else if(msg == "MENU_Mode")
            {
                if(MENU_mode) MENU_mode = FALSE;
                else MENU_mode = TRUE;
            }
        }
        else if(MENU_mode) GET_dest(msg, id);
    }
    timer()
    {
        llOwnerSay("Menu Channel Timeout, Select Menu Button Again");
        llListenRemove(CHANNEL);    // SAFETY Kill CHANNEL incase left over
        llSetTimerEvent(0.0);       // ZERO Timer Event
    }
}


_________________
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 Thu Aug 13, 2009 4:48 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: In-Grid + Teleportation System Script
PostPosted: Thu Aug 13, 2009 4:32 pm 
Site Admin
User avatar

Joined: Wed Jul 16, 2008 7:22 pm
Posts: 186
WhiteStar Magic {L_WROTE}:
This requires a Root Prim with other smaller prims named EXACTLY to match teh entries in the list for the buttons.

You may want to check out Version 2 of the Plaza Teleport System, available in the Wright Plaza freebie building (or see this Forum post for the script)- it's reduced down to one prim, and uses "virtual buttons" based on where the user touches the prim face.

The "buttons" are defined by the object creator based on the underlying texture (see the abovementioned forum post for a script which will let you define the button areas), so there's no need for additional prims that have to be named "just right".


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 2 posts ]


Who is online

Users browsing this forum: No registered users and 5 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