Changes

Jump to navigation Jump to search
[[Category: Useful Scripts]]
[[Category: Opensim Script Library]]
When a user clicks the prim they will get a menu offering to tp them or give information about the place. The information option will deliver all prim contents other than the script and the location note card.
It will work inside the same sim, going to another sim or even another hypergrid destination
 
This script is written in OLSL and will not compile in second life but works in Opensim under both the X and Y Engine.
 
<br>
 
* Create a prim in world
* Add a new script to the prim
* Copy-paste the licence and script
* Make a new notecard called Location and add it to the prims contents
* Adjust the notecard to your requirements
 
<br>
 
=== Script On Github ===
[https://github.com/Fire-And-Ice-Grid/LSL-And-OSSL-Script-Library LSL And OSSL Script Library On GitHub]
 
==== Licence ====
<syntaxhighlight lang="ini" line>
BSD 3-Clause License
Copyright (c) 2020, Sara Payne
</syntaxhighlight>
==== Script ====
<syntaxhighlight lang="lsl" line>
vector landing;
vector lookAt;
string gridUri= "";string regionName= "";string destination= "";integer debug = FALSE;integer mainMenuChannel; //global integer for menu channel integer mainMenuChannelListen;//clobal control integer for turning menu listen on and offkey imageUUID;string name;
SetUpListeners()
llListenControl (mainMenuChannelListen, FALSE); //turns off listeners for main menu channel
}//close set up listeners
 
string locationTestString(string input)
{
string testValue = "TpLocation_";
string testString = llGetSubString(input, 0, llStringLength(testValue)-1);
string locationName = "";
if (testString == testValue)
{
list elements = llParseStringKeepNulls(input, "_", "!");
locationName = llList2String(elements, 1);
}
return locationName;
}
string CleanUpString(string inputString)
string cleanString = llStringTrim( llToLower(inputString), STRING_TRIM );
return cleanString;
}
 
ProcessInstructionLine(string instruction, string data)
{
if (debug)
{
llOwnerSay("Debug:ProcessInstruction: Instruction:" + instruction + " Data:" + data);
}
if (instruction == "landing")
{
landing = (vector)data;
}
else if (instruction == "lookat")
{
lookAt = (vector)data;
}
else if (instruction == "griduri")
{
gridUri = data;
}
else if (instruction == "region")
{
regionName = data;
}
else if (instruction =="image")
{
imageUUID = data;
}
else if (instruction == "name")
{
name = data;
}
}
}//close error the notecard does not exist
}//close read config card.
 
Teleport(key aviUUID)
{
if (gridUri == "")
{
destination = regionName;
}
else
{
destination = gridUri + "/" + regionName;
}
if (destination == "" || destination == "/")
{
if (debug)
{
llOwnerSay("Debug:Teleport: No Desination, same region tp");
}
osTeleportAgent(aviUUID, landing, lookAt);
}
else
{
if (debug)
{
llOwnerSay("Debug:Teleport: Desitination Set as: " + destination);
}
osTeleportAgent(aviUUID, destination, landing, lookAt);
}
llRegionSayTo(aviUUID, 0, "Teleporting you to" + name);
}
 
string SetLocationName()
{
if (debug) llOwnerSay("Debug:SetLocationName:Entered");
string locationName = "";
if (name == "")
{
if (debug) llOwnerSay("Debug:SetLocationName:Empty Name string found");
if (regionName == "")
{
if (debug) llOwnerSay("Debug:SetLocationName:Empty Region Name found, location name set to the region name");
locationName += llGetRegionName();
}
else
{
if (debug) llOwnerSay("Debug:SetLocationName:location name set to the region name");
locationName += regionName;
}
if (gridUri == "")
{
locationName += "@" + osGetGridName();
}
else
{
locationName += gridUri;
}
}
else
{
locationName = name;
}
if (debug) llOwnerSay("Debug:SetLocationName:LocationName: " + locationName);
return locationName;
}
DeliverInfo(key aviUUID)
{
list inventoryItems=[];
integer inventoryNumber = llGetInventoryNumber(INVENTORY_ALL);
integer index;
{
string itemName = llGetInventoryName(INVENTORY_ALL, index);
if (debug) { llOwnerSay("Debug:DeliverInfo:ItemName: " + itemName ); } if (!(itemName == llGetScriptName() || itemName == "TpLocation"))
{
if (debug)
{
llOwnerSay("Debug:DevliverInfo:" + itemName + "added to deliverables");
}
if (llGetInventoryPermMask(itemName, MASK_OWNER) & PERM_COPY)
{
}
}
if (inventoryItems == [] ) llSay { llRegionSayTo(0aviUUID, PUBLIC_CHANNEL, "No copiable items found, sorry."); }
else llGiveInventoryList(aviUUID, llGetObjectName(), inventoryItems); // 3.0 seconds delay
llResetScript();
}
ProcessInstructionLineUpdateImage(string instruction, string data)
{
if llSetLinkPrimitiveParamsFast(instruction == "landing"ALL_SIDES, [PRIM_TEXTURE, ALL_SIDES, imageUUID, <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0]) { landing = (vector)data; } else if (instruction == "lookat") { lookAt = (vector)data; } else if (instruction == "griduri") { gridUri = (data); } else if (instruction == "regoin") { regionName = (data); } destination = gridUri + "/" + regionName;
}
TeleportProcessMenuChoices(key aviUUID, string message)
{
if (destination message == "" || destination == "/Teleport")
{
llOwnerSay("Debug:Teleport: No Desination"); osTeleportAgent(aviUUID, landing, lookAt);
}
elseif (message == "GetInfo")
{
llOwnerSay("Debug:Teleport: Desitination Set"); osTeleportAgentDeliverInfo(aviUUID, destination, landing, lookAt);
}
llRegionSayTo(aviUUID, 0, "Teleporting you to : " + destination);
}
default
{
on_rez(integer start_param) { llResetScript(); }  changed (integer change)// something changed, take action { if (change & (CHANGED_OWNER | CHANGED_REGION_RESTART | CHANGED_INVENTORY | CHANGED_OWNER | CHANGED_REGION_START)) { llResetScript(); } } state_entry() { SetUpListeners(); ReadConfigCards("TpLocation"); UpdateImage(); llSetObjectName(SetLocationName() + " Teleport Board"); } touch_start(integer num_detected) { llListenControl (mainMenuChannelListen, TRUE); list buttons = ["Teleport", "GetInfo"]; llDialog(llDetectedKey(0), "Please select from the following options", buttons, mainMenuChannel); llSetTimerEvent(30); } listen(integer channel, string name, key uuid, string message) {//listens on the set channels, then depending on the heard channel sends the message for processing. if (channel == mainMenuChannel) { ProcessMenuChoices(uuid, message); } }//close listen
on_rez timer(integer start_param) { llWhisper(PUBLIC_CHANNEL, "sorry the menu timed out, please click again"); llResetScript(); } } state_entry()</syntaxhighlight> { SetUpListeners==== Notecard (notecard name must me TpLocation);==== ReadConfigCards(<syntaxhighlight lang="Locationini");line> }#Fire And Ice Teleport Board - Single Location #============================== touch_start(integer count) { #Will work on the same sim //someones touched to another sim on the primsame grid or a location on another grid. #All locations needs a landing point and looking at llListenControl (mainMenuChannelListen, TRUE); list buttons = ["#Teleport", "GetInfo"];In the same region:#---------------------------------- llDialog(llDetectedKey(0), "Please select from # Leave the region name and the following options", buttons, mainMenuChannel); grid uri empty llSetTimerEvent(30); }// close touch start#Teleport To Another Region On The Same Grid #-------------------------------------------------------- listen(integer channel, string #Fill in the region namebut not the Grid Uri, key id, string message) {//listens on #Teleport To Another Region On A Different Grid#--------------------------------------------------------#Fill in the set channels, then depending on region name and the heard channel sends the message for processing. grid uri  if (channel == mainMenuChannel)#Options Description {#-------------------------- llOwnerSay(message);#Blank Lines and lines starting with # are ignored if (message == "Teleport") Teleport(id);#Landing: point is a vector <x,y,z> which represents the landing point on the destination region. else if (message == "GetInfo") DeliverInfo#LookAt: is the direction the avatar will face when they land (idassuming its ever fixed); } }#GridUri: is the URI for the destination grid. Example: http://close listen fireandicegrid.net:8002 #Region: is the name of the destination region. Example: Covey Stores timer()#Image: this is the UUID/Key of the image you wish to display. { llWhisper(PUBLIC_CHANNEL#Name: a descriptive name used to tell people where they are being teleported to, "sorry the menu timed out, please click again"); llResetScript(); } board will also rename its self using this.
}// close state defaultLanding = <132.76846, 128.44232, 23.36178>LookAt = <648.81219, 84.31132, 44.19897>GridUri = Region = Norse AdventureImage = ede3919d-433e-4cc6-841b-04e5f75bd179Name =
</syntaxhighlight>
 
==Syntax Highlighting==
 
[https://www.mediawiki.org/wiki/Extension:SyntaxHighlight GeShi] syntax highlighting is enabled on this wiki. <be>
 
When using the tabs described in the link, change the language part to "lsl". Eg.<br>
syntaxhighlight lang="lsl" line<br>
inside angled brackets <>

Navigation menu