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

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

*file brigadoon_teleporter osl *brief SCript to send a Heartbeat signal to the Teleport Database *version *date December *author River Drifter little sense au
string VERSION_STRING = "2.1.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.
integer LOCAL_TELEPORT_FORCE = TRUE
 Flag about whether Local teleport is used for all in-world regions.
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.
integer ANONYMOUS_FLAG = 16
 This flag designates the teleporter as anonymous.
integer EXTENDED_LOCAL_FLAG = 32
 Flag for Extended Local teleports.
integer REMOTE_UPDATE_FLAG = 64

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 285 of file brigadoon_teleporter.osl.

286{
287 integer random_value = 0x80000000 | (integer)llFrand(65536) | ((integer)llFrand(65536) << 16);
288 return(random_value);
289}

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 356 of file brigadoon_teleporter.osl.

357{
358 // Get information about the Destination Location
359 string the_world = llList2String(destination_world, Index);
360 string the_region = llList2String(destination_region, Index);
361 vector the_landing = (vector)llList2String(destination_location, Index);
362 vector the_look_at = (vector)llList2String(destination_look_at, Index);
363
364 // Update the current location of the Teleporter to select correct Teleportation Routine
365 location_region = llGetRegionName();
366 vector location_position = llGetPos();
367
368 // If the Destination is not in this simulator, use a hop command to get there
369 if (location_world != the_world)
370 {
371 osTeleportAgent(Agent, the_world + ":" + the_region, the_landing, the_look_at);
372 }
373
374 // If the Destination is not in this Region, use a Teleport command that specifies the Region
375 else if (location_region != the_region)
376 {
377 osTeleportAgent(Agent, the_region, the_landing, the_look_at);
378 }
379
380 // If the destination is in this region, but not the landing location of this Teleporter us a local Teleport
381 else if (location_position != the_landing)
382 {
383 osTeleportAgent(Agent, the_landing, the_look_at);
384 }
385}
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 433 of file brigadoon_teleporter.osl.

434{
435 // Get the location of the current world
436 location_world = llGetSubString(osGetGridHomeURI(), 7, -1);
437
438 // Get a Communications Channel. This can been overridden in the basic configuration
440
441 // Read the Configuration File into a List of Lines
442 string config = osGetNotecard(CONFIG_NOTECARD_NAME);
443 list config_data = llParseString2List(config, ["\n"], []);
444
445 // Process each line in the Configuration Data
446 integer index = 0;
447 integer list_length = llGetListLength(config_data);
448 for (; index < list_length; ++index)
449 {
450 // Trim line of Leading and Trailing Spaces
451 string trimmed_line = llStringTrim(llList2String(config_data, index), STRING_TRIM);
452
453 // Only Process lines that are not a comment line or blank
454 if ( (llGetSubString(trimmed_line, 0, COMMENT_PREAMBLE_LENGTH - 1) != COMMENT_PREAMBLE) && (trimmed_line != "") )
455 {
456 // Parse Line for a Configuration Field.
457 list key_value = llParseString2List(trimmed_line, ["="], []);
458
459 // Fold the Trimmed Key into upper case, to eliminate errors where the case is wrong in the config file.
460 string key_object = llToUpper(llStringTrim(llList2String(key_value, 0), STRING_TRIM));
461
462 // Trim the Value to remove leading and training spaces
463 string value_object = llStringTrim(llList2String(key_value, 1), STRING_TRIM);
464
465 // Process the Key-Value Pairs to Set Configuration
466 if (key_object == LOCATION_NAME) location_name = value_object;
467 }
468 location_region = llGetRegionName();
469 }
470
471 // Initial Read of the teleportation Destnation List
473}
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 267 of file brigadoon_teleporter.osl.

268{
269 string location_area = "";
270
271 if ((LocationInfo & LOCAL_FLAG) != 0) location_area = destination_group[Index];
272 else if ((LocationInfo & REGION_FLAG) != 0) location_area = destination_region[Index];
273 else if ((LocationInfo & WORLD_FLAG) != 0) location_area = destination_region[Index];
274 else if ((LocationInfo & METAVERSE_FLAG) != 0) location_area = destination_world[Index];
275 return " [" + location_area + "]";
276}
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 391 of file brigadoon_teleporter.osl.

392{
393 // Clear the Teleportation Lists
397
398 // Loop though Destination Configuration File
399 integer list_length = osGetNumberOfNotecardLines(CONFIG_DESTINATIONS_NAME);
400 integer index = 0;
401 do
402 {
403 // Get the Line
404 string trimmed_line = llStringTrim(osGetNotecardLine(CONFIG_DESTINATIONS_NAME, index), STRING_TRIM);
405
406 // Skip comment lines and blank lines
407 if ( (llGetSubString(trimmed_line, 0, COMMENT_PREAMBLE_LENGTH - 1) != COMMENT_PREAMBLE) && (trimmed_line != "") )
408 {
409 // Split the Teleportation Destination COmponents out.
410 list destination = llParseString2List(trimmed_line, ["|"], []);
411 destination_name += (string)destination[0];
412 destination_world += (string)destination[1];
413 destination_region += (string)destination[2];
414 destination_location += (string)destination[3];
415 destination_look_at += (string)destination[4];
416 destination_loc_type += (string)destination[5];
417 destination_group += (string)destination[6];
418 }
419 }
420 while (++index < list_length);
421
422 // Set the Size of teh Destination List for the Menu
423 station_list_size = llGetListLength(destination_name);
424}
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 297 of file brigadoon_teleporter.osl.

298{
299 list button_list;
300 menu_list = [];
301
302 // Add the back button if necessary
303 if (station_base > 0) button_list += "<<"; else button_list += " ";
304
305 // Add Done Button
306 button_list += "DONE";
307
308 // Add the Forward button, if necessary
309 if (station_list_size > (station_base + DIALOG_STATION_LIMIT)) button_list += ">>"; else button_list += " ";
310
311 // Now select the next (up to) nine (9) locatiions to display on the menu
312 string menu_header = "Destinations Available from " + location_name + "\n";
313 integer index;
314 for (index = 0; index < DIALOG_STATION_LIMIT; ++index)
315 {
316 // Increase the menu number to match the actual number in the destination list, rather than menu number
317 integer station_pos = index + station_base;
318 if (station_pos < station_list_size)
319 {
320 // Get the type of location this destination is
321 integer loc_info = (integer)llList2String(destination_loc_type, station_pos);
322
323 // Get name of the destination and the type of location it is
324 string item_name = llUnescapeURL(llList2String(destination_name, station_pos)) + rdLocInfo2String(loc_info, station_pos);
325 string index_string = (string)(station_pos + 1);
326
327 // Add the Index, Name and location type to the menu header
328 menu_header += "[" + index_string + "] " + item_name + "\n";
329
330 // Add the index to the Buuton List to be displayed
331 button_list += index_string;
332
333 // Add the index to the line that will be scanned to match selections
334 menu_list += index_string;
335 }
336
337 // If there aren't enough destinations to fill the nine (9) spaces use blanks
338 else
339 {
340 // Add to the button list, but not the menu list as we don'r want matches to empty buttons
341 button_list += " ";
342 }
343 }
344
345 // Display the Dialog Menu
346 llDialog(User, menu_header, button_list, comms_channel);
347}
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

◆ ANONYMOUS_FLAG

integer ANONYMOUS_FLAG = 16

This flag designates the teleporter as anonymous.

An anonymouns teleporter is one that resides in the teleporter database, but is not included in the list of avaialble destinations in any teleporter.

This feature is primarily available to allow an admin to get to any destination, without the admin's location being revealed.

Definition at line 240 of file brigadoon_teleporter.osl.

Referenced by rdSetAnonType().

◆ au

* file brigadoon_teleporter osl* brief SCript to send a Heartbeat signal to the Teleport Database* version* date December* author River Drifter little sense au

Definition at line 5 of file brigadoon_teleporter.osl.

◆ 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 50 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 56 of file brigadoon_teleporter.osl.

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

◆ comms_channel

integer comms_channel

Definition at line 167 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 161 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 155 of file brigadoon_teleporter.osl.

Referenced by rdReadDestinationList(), and rdShowStationDialog().

◆ destination_location

list destination_location

Definition at line 142 of file brigadoon_teleporter.osl.

Referenced by rdDoTeleport(), and rdReadDestinationList().

◆ destination_look_at

list destination_look_at

Definition at line 148 of file brigadoon_teleporter.osl.

Referenced by rdDoTeleport(), and rdReadDestinationList().

◆ destination_name

list destination_name

The list of Teleport location names.

Definition at line 124 of file brigadoon_teleporter.osl.

Referenced by rdReadDestinationList(), and rdShowStationDialog().

◆ destination_region

list destination_region

The list of Teleport region names.

Definition at line 136 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 130 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 200 of file brigadoon_teleporter.osl.

Referenced by rdShowStationDialog().

◆ EXTENDED_LOCAL_FLAG

integer EXTENDED_LOCAL_FLAG = 32

Flag for Extended Local teleports.

If this flag is set, use the Extended Local Tepelortatation method.

Definition at line 249 of file brigadoon_teleporter.osl.

Referenced by rdSetExtendedLocal().

◆ 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 194 of file brigadoon_teleporter.osl.

◆ listen_handle

integer listen_handle

\The commujications Channel handle

Definition at line 173 of file brigadoon_teleporter.osl.

◆ LOCAL_FLAG

integer LOCAL_FLAG = 1

Number value of Local Location flag.

Definition at line 207 of file brigadoon_teleporter.osl.

Referenced by rdLocInfo2String().

◆ LOCAL_TELEPORT_FORCE

integer LOCAL_TELEPORT_FORCE = TRUE

Flag about whether Local teleport is used for all in-world regions.

If this parameter is set to TRUE, the destination address is changes from destination region, location to an address modified in raltion to the position of the region that holds the teleporter.

Definition at line 42 of file brigadoon_teleporter.osl.

◆ 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 68 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 118 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 104 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 96 of file brigadoon_teleporter.osl.

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

◆ menu_list

list menu_list

Definition at line 111 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 228 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 214 of file brigadoon_teleporter.osl.

Referenced by rdLocInfo2String(), and rdSetLocationType().

◆ REMOTE_UPDATE_FLAG

integer REMOTE_UPDATE_FLAG = 64

Definition at line 258 of file brigadoon_teleporter.osl.

Referenced by rdSetRemoteUpdate().

◆ station_base

integer station_base = 0

Definition at line 179 of file brigadoon_teleporter.osl.

Referenced by rdShowStationDialog().

◆ station_list_size

integer station_list_size

The total number of Destinations available.

Definition at line 185 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 77 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 83 of file brigadoon_teleporter.osl.

◆ VERSION_STRING

string VERSION_STRING = "2.1.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 221 of file brigadoon_teleporter.osl.

Referenced by rdLocInfo2String(), and rdSetLocationType().