Database Teleporter BRIGADOON-0009
An Open Simulator Teleporter using a central database.
Loading...
Searching...
No Matches
brigadoon_teleporter.osl File Reference

SCript to send a Heartbeat signal to the Teleport Database. More...

Go to the source code of this file.

Functions

string rdLocInfo2String (integer LocationInfo, integer Index)
integer rdCalcCommsChannel ()
 find a pseudo random communications channel number
 rdShowStationDialog (key User)
 Display the Destination Teelport Menu.
 rdDoTeleport (key Agent, integer Index)
 Select the Correct Teleportation Routine.
 rdReadDestinationList ()
 Read the list of Teleportation Destinations from the Notecard.
 rdInitialiseTeleporter ()
 Initialise or re-initialise the Teleporter.

Variables

string VERSION_STRING = "1.2.0"
 The Current version of the software.
string CONFIG_NOTECARD_NAME = "brigadoon_teleporter.config"
 The name of the notecard containing the Teleport's Configuration.
string CONFIG_DESTINATIONS_NAME = "teleport_destinations.config"
 The automatically generated list of teleporter destinations.
string COMMENT_PREAMBLE = "//"
 Preamble for a comment line in the configuration file.
integer COMMENT_PREAMBLE_LENGTH = 2
 THe number of characters in the comment preamble.
string LOCATION_NAME = "LOCATION_NAME"
 THe Key Value for defining hte name of the location in the Config notecard.
float TIME_TO_DECIDE = 60.0
 Time a Menu remains active.
float TIMER_OFF = 0.0
 Settings a Zero Time will turn off the Timer.
string location_world
 The Teleporter Location's World.
string location_region
 Region holding the Teleporter.
list menu_list
string location_name
 The display name of the current location.
list destination_name
 The list of Teleport location names.
list destination_world
 The list of Teleport world addresses.
list destination_region
 The list of Teleport region names.
list destination_location
list destination_look_at
list destination_loc_type
 The list of location types.
list destination_group
 Group to which the Location belongs.
integer comms_channel
integer listen_handle
integer station_base = 0
integer station_list_size
 The total number of Destinations available.
key last_user
 the last user of the teleport menu
integer DIALOG_STATION_LIMIT = 9
 The hard maximum number of Destinations on any menu page.
integer LOCAL_FLAG = 1
 Number value of Local Location flag.
integer REGION_FLAG = 2
 Number value of REgion Location flag.
integer WORLD_FLAG = 4
 Number value of World Location flag.
integer METAVERSE_FLAG = 8
 Number value of Metaverse Location flag.

Detailed Description

SCript to send a Heartbeat signal to the Teleport Database.

Version
1.2.0
Date
25-December-2025
Author
River Drifter @ little-sense.au:9000 \email river.nosp@m._dri.nosp@m.fter@.nosp@m.auss.nosp@m.iebro.nosp@m.adba.nosp@m.nd.co.nosp@m.m.au

NOTE: The file extension ".osl" indicates the script uses the Open Simulator Script language (OSSL) and will not function in the Second Life environment. If the script will function using just the Linden Scripting Language (LSL), it will have a a file extension of ".lsl".

Definition in file brigadoon_teleporter.osl.

Function Documentation

◆ rdCalcCommsChannel()

integer rdCalcCommsChannel ( )

find a pseudo random communications channel number

This random channel generator comes from the Second Life Wiki https://wiki.secondlife.com/wiki/LlFrand

Definition at line 245 of file brigadoon_teleporter.osl.

246{
247 integer random_value = 0x80000000 | (integer)llFrand(65536) | ((integer)llFrand(65536) << 16);
248 return(random_value);
249}

Referenced by rdInitialiseTeleporter().

Here is the caller graph for this function:

◆ rdDoTeleport()

rdDoTeleport ( key Agent,
integer Index )

Select the Correct Teleportation Routine.

Parameters
AgentThe user to be teleported
IndexThe index into the list of possible Teleportation Destinations

Definition at line 316 of file brigadoon_teleporter.osl.

317{
318 // Get information about the Destination Location
319 string the_world = llList2String(destination_world, Index);
320 string the_region = llList2String(destination_region, Index);
321 vector the_landing = (vector)llList2String(destination_location, Index);
322 vector the_look_at = (vector)llList2String(destination_look_at, Index);
323
324 // Update the current location of the Teleporter to select correct Teleportation Routine
325 location_region = llGetRegionName();
326 vector location_position = llGetPos();
327
328 // If the Destination is not in this simulator, use a hop command to get there
329 if (location_world != the_world)
330 {
331 osTeleportAgent(Agent, the_world + ":" + the_region, the_landing, the_look_at);
332 }
333
334 // If the Destination is not in this Region, use a Teleport command that specifies the Region
335 else if (location_region != the_region)
336 {
337 osTeleportAgent(Agent, the_region, the_landing, the_look_at);
338 }
339
340 // If the destination is in this region, but not the landing location of this Teleporter us a local Teleport
341 else if (location_position != the_landing)
342 {
343 osTeleportAgent(Agent, the_landing, the_look_at);
344 }
345}
list destination_look_at
list destination_location
list destination_region
The list of Teleport region names.
string location_region
Region holding the Teleporter.
list destination_world
The list of Teleport world addresses.
string location_world
The Teleporter Location's World.

References destination_location, destination_look_at, destination_region, destination_world, location_region, and location_world.

◆ rdInitialiseTeleporter()

rdInitialiseTeleporter ( )

Initialise or re-initialise the Teleporter.

This routine will initialise the Teleporter by reconfiguring it from the configuration file, and then (re)load the destination file,

Definition at line 393 of file brigadoon_teleporter.osl.

394{
395 // Get the location of the current world
396 location_world = llGetSubString(osGetGridHomeURI(), 7, -1);
397
398 // Get a Communications Channel. This can been overridden in the basic configuration
400
401 // Read the Configuration File into a List of Lines
402 string config = osGetNotecard(CONFIG_NOTECARD_NAME);
403 list config_data = llParseString2List(config, ["\n"], []);
404
405 // Process each line in the Configuration Data
406 integer index = 0;
407 integer list_length = llGetListLength(config_data);
408 for (; index < list_length; ++index)
409 {
410 // Trim line of Leading and Trailing Spaces
411 string trimmed_line = llStringTrim(llList2String(config_data, index), STRING_TRIM);
412
413 // Only Process lines that are not a comment line or blank
414 if ( (llGetSubString(trimmed_line, 0, COMMENT_PREAMBLE_LENGTH - 1) != COMMENT_PREAMBLE) && (trimmed_line != "") )
415 {
416 // Parse Line for a Configuration Field.
417 list key_value = llParseString2List(trimmed_line, ["="], []);
418
419 // Fold the Trimmed Key into upper case, to eliminate errors where the case is wrong in the config file.
420 string key_object = llToUpper(llStringTrim(llList2String(key_value, 0), STRING_TRIM));
421
422 // Trim the Value to remove leading and training spaces
423 string value_object = llStringTrim(llList2String(key_value, 1), STRING_TRIM);
424
425 // Process the Key-Value Pairs to Set Configuration
426 if (key_object == LOCATION_NAME) location_name = value_object;
427 }
428 location_region = llGetRegionName();
429 }
430
431 // Initial Read of the teleportation Destnation List
433}
integer COMMENT_PREAMBLE_LENGTH
THe number of characters in the comment preamble.
string location_name
The display name of the current location.
string CONFIG_NOTECARD_NAME
The name of the notecard containing the Teleport's Configuration.
string LOCATION_NAME
THe Key Value for defining hte name of the location in the Config notecard.
integer rdCalcCommsChannel()
find a pseudo random communications channel number
integer comms_channel
rdReadDestinationList()
Read the list of Teleportation Destinations from the Notecard.
string COMMENT_PREAMBLE
Preamble for a comment line in the configuration file.

References COMMENT_PREAMBLE, COMMENT_PREAMBLE_LENGTH, comms_channel, CONFIG_NOTECARD_NAME, LOCATION_NAME, location_name, location_region, location_world, rdCalcCommsChannel(), and rdReadDestinationList().

Here is the call graph for this function:

◆ rdLocInfo2String()

string rdLocInfo2String ( integer LocationInfo,
integer Index )

Definition at line 227 of file brigadoon_teleporter.osl.

228{
229 string location_area = "";
230
231 if ((LocationInfo & LOCAL_FLAG) != 0) location_area = destination_group[Index];
232 else if ((LocationInfo & REGION_FLAG) != 0) location_area = destination_region[Index];
233 else if ((LocationInfo & WORLD_FLAG) != 0) location_area = destination_region[Index];
234 else if ((LocationInfo & METAVERSE_FLAG) != 0) location_area = destination_world[Index];
235 return " [" + location_area + "]";
236}
integer REGION_FLAG
Number value of REgion Location flag.
list destination_group
Group to which the Location belongs.
integer METAVERSE_FLAG
Number value of Metaverse Location flag.
integer WORLD_FLAG
Number value of World Location flag.
integer LOCAL_FLAG
Number value of Local Location flag.

References destination_group, destination_region, destination_world, LOCAL_FLAG, METAVERSE_FLAG, REGION_FLAG, and WORLD_FLAG.

Referenced by rdShowStationDialog().

Here is the caller graph for this function:

◆ rdReadDestinationList()

rdReadDestinationList ( )

Read the list of Teleportation Destinations from the Notecard.

Definition at line 351 of file brigadoon_teleporter.osl.

352{
353 // Clear the Teleportation Lists
357
358 // Loop though Destination Configuration File
359 integer list_length = osGetNumberOfNotecardLines(CONFIG_DESTINATIONS_NAME);
360 integer index = 0;
361 do
362 {
363 // Get the Line
364 string trimmed_line = llStringTrim(osGetNotecardLine(CONFIG_DESTINATIONS_NAME, index), STRING_TRIM);
365
366 // Skip comment lines and blank lines
367 if ( (llGetSubString(trimmed_line, 0, COMMENT_PREAMBLE_LENGTH - 1) != COMMENT_PREAMBLE) && (trimmed_line != "") )
368 {
369 // Split the Teleportation Destination COmponents out.
370 list destination = llParseString2List(trimmed_line, ["|"], []);
371 destination_name += (string)destination[0];
372 destination_world += (string)destination[1];
373 destination_region += (string)destination[2];
374 destination_location += (string)destination[3];
375 destination_look_at += (string)destination[4];
376 destination_loc_type += (string)destination[5];
377 destination_group += (string)destination[6];
378 }
379 }
380 while (++index < list_length);
381
382 // Set the Size of teh Destination List for the Menu
383 station_list_size = llGetListLength(destination_name);
384}
string CONFIG_DESTINATIONS_NAME
The automatically generated list of teleporter destinations.
integer station_list_size
The total number of Destinations available.
list destination_name
The list of Teleport location names.
list destination_loc_type
The list of location types.

References COMMENT_PREAMBLE, COMMENT_PREAMBLE_LENGTH, CONFIG_DESTINATIONS_NAME, destination_group, destination_loc_type, destination_location, destination_look_at, destination_name, destination_region, destination_world, and station_list_size.

Referenced by rdInitialiseTeleporter().

Here is the caller graph for this function:

◆ rdShowStationDialog()

rdShowStationDialog ( key User)

Display the Destination Teelport Menu.

Theis routine displays the dialog that displays the teleport destinations selections.

Definition at line 257 of file brigadoon_teleporter.osl.

258{
259 list button_list;
260 menu_list = [];
261
262 // Add the back button if necessary
263 if (station_base > 0) button_list += "<<"; else button_list += " ";
264
265 // Add Done Button
266 button_list += "DONE";
267
268 // Add the Forward button, if necessary
269 if (station_list_size > (station_base + DIALOG_STATION_LIMIT)) button_list += ">>"; else button_list += " ";
270
271 // Now select the next (up to) nine (9) locatiions to display on the menu
272 string menu_header = "Destinations Available from " + location_name + "\n";
273 integer index;
274 for (index = 0; index < DIALOG_STATION_LIMIT; ++index)
275 {
276 // Increase the menu number to match the actual number in the destination list, rather than menu number
277 integer station_pos = index + station_base;
278 if (station_pos < station_list_size)
279 {
280 // Get the type of location this destination is
281 integer loc_info = (integer)llList2String(destination_loc_type, station_pos);
282
283 // Get name of the destination and the type of location it is
284 string item_name = llUnescapeURL(llList2String(destination_name, station_pos)) + rdLocInfo2String(loc_info, station_pos);
285 string index_string = (string)(station_pos + 1);
286
287 // Add the Index, Name and location type to the menu header
288 menu_header += "[" + index_string + "] " + item_name + "\n";
289
290 // Add the index to the Buuton List to be displayed
291 button_list += index_string;
292
293 // Add the index to the line that will be scanned to match selections
294 menu_list += index_string;
295 }
296
297 // If there aren't enough destinations to fill the nine (9) spaces use blanks
298 else
299 {
300 // Add to the button list, but not the menu list as we don'r want matches to empty buttons
301 button_list += " ";
302 }
303 }
304
305 // Display the Dialog Menu
306 llDialog(User, menu_header, button_list, comms_channel);
307}
list menu_list
string rdLocInfo2String(integer LocationInfo, integer Index)
integer station_base
integer DIALOG_STATION_LIMIT
The hard maximum number of Destinations on any menu page.

References comms_channel, destination_loc_type, destination_name, DIALOG_STATION_LIMIT, location_name, menu_list, rdLocInfo2String(), station_base, and station_list_size.

Here is the call graph for this function:

Variable Documentation

◆ COMMENT_PREAMBLE

string COMMENT_PREAMBLE = "//"

Preamble for a comment line in the configuration file.

Any line starting with this is a comment.

The configuration file only allows comments which take up the complete lilne in the file.

Definition at line 40 of file brigadoon_teleporter.osl.

Referenced by rdInitialiseTeleporter(), rdReadConfigNotecard(), and rdReadDestinationList().

◆ COMMENT_PREAMBLE_LENGTH

integer COMMENT_PREAMBLE_LENGTH = 2

THe number of characters in the comment preamble.

THe number of characters in the comment preamble Menu Item = [17:16] Nothing Found!

The length of the comment preamble.

Definition at line 46 of file brigadoon_teleporter.osl.

Referenced by rdInitialiseTeleporter(), rdReadConfigNotecard(), and rdReadDestinationList().

◆ comms_channel

integer comms_channel

Definition at line 157 of file brigadoon_teleporter.osl.

Referenced by rdInitialiseTeleporter(), and rdShowStationDialog().

◆ CONFIG_DESTINATIONS_NAME

string CONFIG_DESTINATIONS_NAME = "teleport_destinations.config"

The automatically generated list of teleporter destinations.

Notecard holding the Teleport Destination Locations.

This notecard is generated by the teleporter_heartbeat.osl script based on the settings in the CONFIG_NOTECARD_NAME notecard. If you want to place teleporter destinations in this file, you will need to disable the teleporter_destinations.osl script which periodically erases this file and replaces it withe the lastest values from the Database.

Definition at line 32 of file brigadoon_teleporter.osl.

Referenced by rdReadDestinationList(), and rdSaveNewTeleportNotecard().

◆ CONFIG_NOTECARD_NAME

string CONFIG_NOTECARD_NAME = "brigadoon_teleporter.config"

The name of the notecard containing the Teleport's Configuration.

Script(s) Configuration Notecard.

The name of the script configuration Notecard.

This notecard is used to configure the brigadoon_teleporter.osl and the teleporter_heartbeat.osl scripts.

Definition at line 26 of file brigadoon_teleporter.osl.

Referenced by rdInitialiseTeleporter(), and rdStateEntry().

◆ destination_group

list destination_group

Group to which the Location belongs.

Definition at line 151 of file brigadoon_teleporter.osl.

Referenced by rdLocInfo2String(), and rdReadDestinationList().

◆ destination_loc_type

list destination_loc_type

The list of location types.

Definition at line 145 of file brigadoon_teleporter.osl.

Referenced by rdReadDestinationList(), and rdShowStationDialog().

◆ destination_location

list destination_location

Definition at line 132 of file brigadoon_teleporter.osl.

Referenced by rdDoTeleport(), and rdReadDestinationList().

◆ destination_look_at

list destination_look_at

Definition at line 138 of file brigadoon_teleporter.osl.

Referenced by rdDoTeleport(), and rdReadDestinationList().

◆ destination_name

list destination_name

The list of Teleport location names.

Definition at line 114 of file brigadoon_teleporter.osl.

Referenced by rdReadDestinationList(), and rdShowStationDialog().

◆ destination_region

list destination_region

The list of Teleport region names.

Definition at line 126 of file brigadoon_teleporter.osl.

Referenced by rdDoTeleport(), rdLocInfo2String(), and rdReadDestinationList().

◆ destination_world

list destination_world

The list of Teleport world addresses.

Definition at line 120 of file brigadoon_teleporter.osl.

Referenced by rdDoTeleport(), rdLocInfo2String(), and rdReadDestinationList().

◆ DIALOG_STATION_LIMIT

integer DIALOG_STATION_LIMIT = 9

The hard maximum number of Destinations on any menu page.

Definition at line 190 of file brigadoon_teleporter.osl.

Referenced by rdShowStationDialog().

◆ last_user

key last_user

the last user of the teleport menu

If the current user is not the same as the last user, the station base will be reset.

Definition at line 184 of file brigadoon_teleporter.osl.

◆ listen_handle

integer listen_handle

\The commujications Channel handle

Definition at line 163 of file brigadoon_teleporter.osl.

◆ LOCAL_FLAG

integer LOCAL_FLAG = 1

Number value of Local Location flag.

Definition at line 197 of file brigadoon_teleporter.osl.

Referenced by rdLocInfo2String().

◆ LOCATION_NAME

string LOCATION_NAME = "LOCATION_NAME"

THe Key Value for defining hte name of the location in the Config notecard.

The Configuration File Identifier for the Name of the LOcation.

\string LOCATION_NAME

Definition at line 58 of file brigadoon_teleporter.osl.

Referenced by rdInitialiseTeleporter().

◆ location_name

string location_name

The display name of the current location.

The location name display by the Teleporter.

This name will be displayed in the Teleporter Menu as the location to be visited.

Definition at line 108 of file brigadoon_teleporter.osl.

Referenced by rdInitialiseTeleporter(), rdSendHeartbeatMessage(), and rdShowStationDialog().

◆ location_region

string location_region

Region holding the Teleporter.

This information is read from the teleporter

Definition at line 94 of file brigadoon_teleporter.osl.

Referenced by rdAdjustPosition(), rdDoTeleport(), and rdInitialiseTeleporter().

◆ location_world

string location_world

The Teleporter Location's World.

This is the address of the world in which this script resides.

This string is what the teleporter display will show as the name of this location. The contents of this string are set in the object's description field.

NOTE: This value will default to "DUMMY" to indicate that the Hypergrid is not available. This value can be over-written in the "teleporter.config" notecard to provide an actual virtual world

This location can be used to limit the scans to the current world. This allows different update rates to be set on different worlds, if desired.

Definition at line 86 of file brigadoon_teleporter.osl.

Referenced by rdAdjustPosition(), rdDoTeleport(), rdInitialiseTeleporter(), rdSendHeartbeatMessage(), rdsScanDestinationDatabase(), and rdStateEntry().

◆ menu_list

list menu_list

Definition at line 101 of file brigadoon_teleporter.osl.

Referenced by rdShowStationDialog().

◆ METAVERSE_FLAG

integer METAVERSE_FLAG = 8

Number value of Metaverse Location flag.

Numeric identifier of a Metaverse Location.

Definition at line 218 of file brigadoon_teleporter.osl.

Referenced by rdLocInfo2String(), and rdSetLocationType().

◆ REGION_FLAG

integer REGION_FLAG = 2

Number value of REgion Location flag.

Numeric identifier of a REgion Location.

Definition at line 204 of file brigadoon_teleporter.osl.

Referenced by rdLocInfo2String(), and rdSetLocationType().

◆ station_base

integer station_base = 0

Definition at line 169 of file brigadoon_teleporter.osl.

Referenced by rdShowStationDialog().

◆ station_list_size

integer station_list_size

The total number of Destinations available.

Definition at line 175 of file brigadoon_teleporter.osl.

Referenced by rdReadDestinationList(), and rdShowStationDialog().

◆ TIME_TO_DECIDE

float TIME_TO_DECIDE = 60.0

Time a Menu remains active.

This is the time period during which the script will respond to the Menu. After that time, the script will ignore menu responses.

Definition at line 67 of file brigadoon_teleporter.osl.

◆ TIMER_OFF

float TIMER_OFF = 0.0

Settings a Zero Time will turn off the Timer.

Set the Timer delay to 0.0 which turns off the timer events.

Definition at line 73 of file brigadoon_teleporter.osl.

◆ VERSION_STRING

string VERSION_STRING = "1.2.0"

The Current version of the software.

The Version number as a sring.

Definition at line 20 of file brigadoon_teleporter.osl.

Referenced by rdsScanDestinationDatabase(), and rdWriteStatusNotercard().

◆ WORLD_FLAG

integer WORLD_FLAG = 4

Number value of World Location flag.

Definition at line 211 of file brigadoon_teleporter.osl.

Referenced by rdLocInfo2String(), and rdSetLocationType().