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
<br>
 
* Create a prim in world
* Add a new script to the prim
* Make a new notecard called Location and add it to the prims contents
* Adjust the notecard to your requirements
* Edit the two lists in the User Variables to change the fixed and dynamic button names
<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
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 (itemName != llGetScriptName() && itemName != "Location"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) { llResetScript(); } state_entry() { SetUpListeners(); ReadConfigCards llWhisper(PUBLIC_CHANNEL, "Location"); } touch_start(integer count) { //someones touched sorry the prim llListenControl (mainMenuChannelListen, TRUE); list buttons = ["Teleport", "GetInfo"]; llDialog(llDetectedKey(0)menu timed out, please click again"Please select from the following options", buttons, mainMenuChannel); llSetTimerEvent llResetScript(30); }// close touch start } listen(integer channel, string name, key id, string message)</syntaxhighlight> {//listens on the set channels, then depending on the heard channel sends the message for processing. if (channel == mainMenuChannel) { llOwnerSay== Notecard (messagenotecard name must me TpLocation); if (message == "Teleport") Teleport(id); else if (message == "GetInfo") DeliverInfo(id); } }//close listen timer() { llWhisper(PUBLIC_CHANNEL, <syntaxhighlight lang="sorry the menu timed out, please click againini");line> llResetScript();#Fire And Ice Teleport Board - Single Location } #==============================
}#Will work on the same sim // close state defaultto another sim on the same grid or a location on another grid. </syntaxhighlight>#All locations needs a landing point and looking at
==== Notecard ====<syntaxhighlight lang="" line>#Teleport In the same region:#Location Config Card----------------------------------#==============Leave the region name and the grid uri empty
# Blank lines are ignoredTeleport To Another Region On The Same Grid# Lines starting with a --------------------------------------------------------# are ingoredFill in the region name but not the Grid Uri,
#Teleport To make a TP inside the same region leave the GRIDURI and Another Region blankOn A Different Grid#Landing is the region position <x,y,z>#LookAt is the direction <x,y,z> - this doesn't always work#Grid Uri Examp;e: http://fireandicegrid.net:8002-------------------------------------------------------#Region is Fill in the region nameand the grid uri
#Options Description#--------------------------#Blank Lines and lines starting with # are ignored#Landing = : point is a vector <1x,1y,25z>which represents the landing point on the destination region. #LookAt = <0,0,0>: is the direction the avatar will face when they land (assuming its ever fixed)GRIDURI = #GridUri: is the URI for the destination grid. Example: http://fireandicegrid.net:8002#Region = : is the name of the destination region. Example: Covey Stores<syntaxhighlight lang="" line>#Image: this is the UUID/Key of the image you wish to display. #Name: a descriptive name used to tell people where they are being teleported to, the board will also rename its self using this.
Landing = <132.76846, 128.44232, 23.36178>
LookAt = <648.81219, 84.31132, 44.19897>
GridUri =
Region = Norse Adventure
Image = ede3919d-433e-4cc6-841b-04e5f75bd179
Name =
</syntaxhighlight>

Navigation menu