Difference between revisions of "Teleporter Anywhere"

From Second Life Wiki
Jump to navigation Jump to search
Line 40: Line 40:
//                      Zx Teleporter Anywhere v5.1                        //
//                      Zx Teleporter Anywhere v5.1                        //
//                                                                          //
//                                                                          //
//    Copyright (C) 2016 Luxen - Zonyx Technology                          //
//    Copyright (C) 2017 Luxen - Zonyx Technology                          //
//    This program is free software: you can redistribute it and/or modify  //
//    This program is free software: you can redistribute it and/or modify  //
//    it under the terms of the GNU General Public License version 3, as    //
//    it under the terms of the GNU General Public License version 3, as    //

Revision as of 13:19, 10 January 2017

Teleporter_Anywhere | Ultimate_Radar | Language_Scanner | Visitor_Counter_Tracker

Zx Teleporter Anywhere

Teleport easily to the same land, teleport to an entire region or teleport to an other Sim.

  • Copyright (C) 2017 Luxen - Luxen_Resident - version 5.1
  • New system, easy to use, no lag, safe, secure and all is menu based.

Setup:

  1. Rez the Zx Teleporter on your land where you want your first location and up it to 1 meter above the floor. And click on it to open the menu.
  2. Choose in the menu the "Save Dest 1" Button (to save the first destination coordinate).
  3. Reopen the menu and choose the "Dest name 1" Button and type the name of the first destination.
  4. Take it in your inventory, and go to the second destination of your choice, rez it and up it to 1 meter above the floor. And use the menu to save the coordinate of the second destination and to set the name of the destination ("Save Dest 2" and "Dest Name 2").
  5. Take it in your inventory and Rez the Teleporter where you want on your land. Click on it to open the Menu and choose the "Ready" Button and the setup is finish.

Now if someone click on it, he will can choose one of the 2 links to teleport him at the first or at the second destination.

  • Ready Button:

Lock the Admin menu: the Admin menu will be unavailable until the next rez. So if you need to access at the Admin menu: Take it in your inventory and rez it.

  • Important:

To allow users to teleport anywhere in your land: you need to allow it in your Land Settings (Options tab and Teleport routing): Anywhere (teleports may arrive at any location on the parcel). If your land is "Group owned", you can allow it just for this group: to disallow it in the Land Settings and to allow it for the Group: Group Profile -> "Roles" section -> "Abilities" tab...

Code:

//////////////////////////////////////////////////////////////////////////////
//                      Zx Teleporter Anywhere v5.1                         //
//                                                                          //
//    Copyright (C) 2017 Luxen - Zonyx Technology                           //
//    This program is free software: you can redistribute it and/or modify  //
//    it under the terms of the GNU General Public License version 3, as    //
//    published by the Free Software Foundation.                            //
//                                                                          //
//    This program is distributed in the hope that it will be useful,       //
//    but WITHOUT ANY WARRANTY; without even the implied warranty of        //
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         //
//    GNU General Public License for more details.                          //
//                                                                          //
//   You should have received a copy of the GNU General Public License      //
//    along with this program.  If not, see <http://www.gnu.org/licenses/>  //
//////////////////////////////////////////////////////////////////////////////

key owner = NULL_KEY;
integer New_Key = TRUE;
integer Ready = TRUE;
integer Zchan = -58846;
integer CTimer = FALSE;
integer ZxMenu = FALSE;
integer ZxText1 = FALSE;
integer ZxText2 = FALSE;
integer TOwner = FALSE;
integer TMember = FALSE;
string TDest1 = "Banyan/70/79/96";
string MDest1 = "Gadgets:";
string TDest2 = "Banyan/70/79/96";
string MDest2 = "Freebies:";
integer listenHandle;

FCTimer()
{
    if (CTimer) 
    {
        llSetTimerEvent(0.0);
        CTimer = FALSE;
    }
}
ChangeColor(vector Tcolor)
{
    vector SColor = llGetColor(2);
    if (SColor != Tcolor) llSetColor(Tcolor, 2);
}
string SetDest(vector VDest)
{
    return llEscapeURL(llGetRegionName()) + "/" + (string)llRound(VDest.x) + "/" + (string)llRound(VDest.y) + "/" + (string)llRound(VDest.z);
}

default
{ 

    state_entry()
    {
        if (owner)  ;
        else 
        {
            owner = llGetOwner();
            ChangeColor(<0.239, 0.600, 0.439>);
        }
        if (New_Key) 
        {
            New_Key = FALSE;
            Ready = TRUE;
            Zchan = 0x80000000 | (integer)("0x"+(string)llGetKey());
        }
        FCTimer();
        ZxMenu = FALSE;
        ZxText1 = FALSE;
        ZxText2 = FALSE;
    }

    on_rez(integer start_param)
    {
        if (owner != llGetOwner()) llResetScript();
        else 
        {
            New_Key = TRUE;
            state restart_scr;
        }
    }

    changed(integer change)
    {
        if (change & CHANGED_REGION_START)
        {
            llSleep(5.0);
            state restart_scr;
        }
    }
    
    touch_start(integer num_detected)
    {
        key ZTouch = llDetectedKey(0);
        integer Zpass = FALSE;
        if (TOwner)
        {
            if (ZTouch == owner) Zpass = TRUE;
        }
        else if (TMember)
        {
            integer ObjectGroup = FALSE;
            list details = llGetObjectDetails(llGetKey(),[OBJECT_GROUP]);
            if (llList2Key(details, 0)) ObjectGroup = TRUE;
            if (llSameGroup(ZTouch) && ObjectGroup) Zpass = TRUE;
            else if (ZTouch == owner) Zpass = TRUE;
        }
        else Zpass = TRUE;
        
        if (Zpass)
        {
            string Dest = "\n " + "\n " + MDest1
                      + "\n " + "secondlife:///app/teleport/" + TDest1
                      + "\n " + "\n " + MDest2
                      + "\n " + "secondlife:///app/teleport/" + TDest2;
            if (Ready)
            {
                if (ZTouch == owner)
                {
                    Dest = "- Click on the links below -"
                    + "\n (Buttons are only visible to the Owner)" + Dest;
                    llListenRemove(listenHandle);
                    llSetTimerEvent(120.0);
                    CTimer = TRUE;
                    list Teleport_Tab = ["Public", "Member Only", "Owner Only", "Dest Name 1", "Save Dest 2", "Dest Name 2", "Reset", "Ready", "Save Dest 1", "Close"];
                    llDialog(ZTouch, Dest, Teleport_Tab , Zchan);
                    listenHandle = llListen(Zchan, "", owner, "");
                    ZxMenu = TRUE;
                    return;
                }
            }
            Dest = "- Click on the links below -" + Dest;
            llDialog(ZTouch, Dest, ["Close"], -5958);
        }
    }
    
    listen(integer channel, string name, key id, string msg)
    {
        if (ZxMenu)
        {
            if(channel == Zchan && id == owner)
            {
                integer Tmsg = llStringLength(msg);
                if (Tmsg < 50)
                {
                    if (msg == "Public")
                    {
                        TOwner = FALSE;
                        TMember = FALSE;
                        ChangeColor(<0.239, 0.600, 0.439>);
                    }
                    else if (msg == "Member Only")
                    {
                        TOwner = FALSE;
                        TMember = TRUE;
                        ChangeColor(<0.000, 0.455, 0.851>);
                    }
                    else if (msg == "Owner Only")
                    {
                        TOwner = TRUE;
                        TMember = FALSE;
                        ChangeColor(<1.000, 0.255, 0.212>);
                    }
                    else if (msg == "Reset")
                    {
                        llSleep(0.5);
                        llResetScript();
                    }
                    else if (msg == "Ready") Ready = FALSE;
                    else if (msg == "Close")  ;
                    else if (msg == "Save Dest 2")
                    {
                        vector VDest2 = llGetPos();
                        TDest2 = SetDest(VDest2);
                    }
                    else if (msg == "Dest Name 2")
                    {
                        llTextBox(owner, "Type the name of the destination 2... (Max: 50)", Zchan);
                        ZxText2 = TRUE;
                        ZxText1 = FALSE;
                        return;
                    }
                    else if (msg == "Save Dest 1")
                    {
                        vector VDest1 = llGetPos();
                        TDest1 = SetDest(VDest1);
                    }
                    else if (msg == "Dest Name 1")
                    {
                        llTextBox(owner, "Type the name of the destination 1... (Max: 50)", Zchan);
                        ZxText1 = TRUE;
                        ZxText2 = FALSE;
                        return;
                    }
                    else if (ZxText1)
                    {
                        msg = llStringTrim(msg, STRING_TRIM);
                        if (msg) MDest1 = msg;
                    }
                    else if (ZxText2)
                    {
                        msg = llStringTrim(msg, STRING_TRIM);
                        if (msg) MDest2 = msg;
                    }
                    else return;
                    llListenRemove(listenHandle);
                    state restart_scr;
                }
            }
        }
    }

    timer()
    {
        llWhisper(0,"Resetting listen...\nMenu Off");
        state restart_scr;
    }
}

state restart_scr
{
    state_entry()
    {
        state default;
    }

    on_rez(integer start_param)
    {
        if (owner != llGetOwner()) llResetScript();
        else 
        {
            New_Key = TRUE;
            state default;
        }
    }
}