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 (debug) { llOwnerSay("Debug:DeliverInfo:ItemName: " + itemName ); } if (!(itemName == llGetScriptName() && || itemName !== "LocationTpLocation"))
{
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 (mainMenuChannelListenmenu timed out, TRUEplease click again"); list buttons = ["Teleport", "GetInfo"]; llDialog llResetScript(llDetectedKey(0), "Please select from the following options", buttons, mainMenuChannel); llSetTimerEvent(30); } }<// close touch startsyntaxhighlight> listen==== Notecard (integer channel, string notecard name, key id, string messagemust me TpLocation) {//listens on the set channels, then depending on the heard channel sends the message for processing. if (channel == mainMenuChannel) { llOwnerSay(message);== if (message =<syntaxhighlight lang= "Teleportini") line>#Fire And Ice Teleport(id);Board - Single Location else if (message #============================== "GetInfo") DeliverInfo(id); } }#Will work on the same sim //close listen timer() { llWhisper(PUBLIC_CHANNEL, "sorry to another sim on the menu timed out, please click again");same grid or a location on another grid. llResetScript(); } #All locations needs a landing point and looking at
}// close state default#Teleport In the same region:</syntaxhighlight>#----------------------------------# Leave the region name and the grid uri empty
==== Notecard ====<syntaxhighlight lang="" line>#Teleport To Another Region On The Same Grid#Location Config Card--------------------------------------------------------#==============Fill in the region name but not the Grid Uri,
# Blank lines are ignoredTeleport To Another Region On A Different Grid# Lines starting with a --------------------------------------------------------# are ingoredFill in the region name and the grid uri
#To make a TP inside the same region leave the GRIDURI Options Description#--------------------------#Blank Lines and Region blanklines starting with # are ignored#Landing : point is the region position a vector <x,y,z>which represents the landing point on the destination region. #LookAt : is the direction <x,y,z> - this doesn't always workthe avatar will face when they land (assuming its ever fixed)#Grid Uri Examp;eGridUri: is the URI for the destination grid. Example: http://fireandicegrid.net:8002#Region : is the name of the destination region . Example: Covey Stores#Image: this is the UUID/Key of the image you wish to display. #Name: a descriptive nameused to tell people where they are being teleported to, the board will also rename its self using this.
Landing = <1132.76846,1128.44232,2523.36178>LookAt = <0648.81219,084.31132,044.19897>GRIDURI GridUri = Region = Norse AdventureImage = ede3919d-433e-4cc6-841b-04e5f75bd179Name =
</syntaxhighlight>

Navigation menu