Database Signage BRIGADOON-0012
Update Signage in Open Simulator from Database
Loading...
Searching...
No Matches
signage_heartbeat.osl File Reference

Script to send a Heartbeat signal to the Signage Table. More...

Go to the source code of this file.

Functions

 rdProcessFailureMessage (string FailureMessage)
 Convert error messages into something that is more readable.
integer rdGetVersionNumber (string VersionString)
 Convert Version String into an Integer.
 rdSaveNewTeleportNotecard (list teleport_list)
 Save the Teleportation Destinations into a Notecard.
 rdSendHeartbeatMessage ()

Variables

string VERSION_STRING = "0.0.1"
float MINIMUM_HEARTBEAT_PERIOD = 0.1
 The fastest allowable heartbeat.
string CONFIG_NOTECARD_NAME = "brigadoon_signage.config"
 Script(s) Configuration Notecard.
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 Menu Item = [17:16] Nothing Found!
string DATABASE_INTERFACE = "DATABASE_INTERFACE"
 The Configuration File Identifier for the Database Interface URL.
string HEARTBEAT_PERIOD = "HEARTBEAT_PERIOD"
 The Configuration File Identifier for the Heartbeat Period.
float TIMER_OFF = 0.0
 Set the Timer delay to 0.0 which turns off the timer events.
float MINIMUM_HEARTBEAT_INTERVAL = 600
float MINIMUM_OFFSET = 0.5
 Minimum allowable offset.
key heartbeat_key
 The Heatbeat HTTP Requrest Key.
string database_interface
 The address of the database interface.
float heartbeat_period
 Interval in seconds between Heartbeat messages.
integer version_number
 Version number as integer.

Detailed Description

Script to send a Heartbeat signal to the Signage Table.

Version
0.0.1
Date
01-February-2026
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

Additional Information: https://www.little-sense.au/project_dynamic/BRIGADOON-0012/html/index.html

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 signage_heartbeat.osl.

Function Documentation

◆ rdGetVersionNumber()

integer rdGetVersionNumber ( string VersionString)

Convert Version String into an Integer.

Parameters
VersionString to be converted
Returns
Integer value of the Version String

Definition at line 150 of file signage_heartbeat.osl.

151{
152 integer version;
153
154 list versions = llParseString2List(VersionString, ["."], []);
155 version = (integer)llList2String(versions,2) + ((integer)llList2String(versions,1) * 100) + ((integer)llList2String(versions,0) * 10000);
156
157 return version;
158}

◆ rdProcessFailureMessage()

rdProcessFailureMessage ( string FailureMessage)

Convert error messages into something that is more readable.

Parameters
Theerror message string to be decoded

This routine takes the abbreviated error message and expands this to an error message that should be more readable by a user not familar with how the program operates.

Definition at line 124 of file signage_heartbeat.osl.

125{
126 string failure_message;
127
128 list status = llParseString2List(FailureMessage, [":"], ["\n"]);
129 string failure_type = llList2String(status, 0);
130
131 // Explain why the Teleporter could not be automatically processed
132 if (failure_type == "BANNED")
133 {
134 failure_message = "Teleporters owned by user " + llList2String(status, 1) + " are not permitted to";
135 failure_message += " add teleporters to the database, update teleporter information or update teleporter destinations.";
136 }
137
138 // Tell the person what to do if there was an error.
139 failure_message += "\n If you wish to report this as an error please send this message to River Drifter with details of what happened and when.\n";
140 llSay(0, failure_message);
141}

◆ rdSaveNewTeleportNotecard()

rdSaveNewTeleportNotecard ( list teleport_list)

Save the Teleportation Destinations into a Notecard.

Parameters
telport_listList of telportation destinations

This routine will remove the Teleportation Notecard and make a new Notecard.

Definition at line 168 of file signage_heartbeat.osl.

169{
170 // Add the Preamble Text before the List of Destinations
171 teleport_list = destination_preamble + teleport_list;
172
173 // Delete the Existing Teleporter Destination Notecard, if it exists
174 integer count = llGetInventoryNumber(INVENTORY_NOTECARD);
175 integer index = 0;
176 for (; index < count; ++index)
177 {
178 if (llGetInventoryName(INVENTORY_NOTECARD, index) == CONFIG_DESTINATIONS_NAME)
179 {
180 llRemoveInventory(CONFIG_DESTINATIONS_NAME);
181 index = count; // Ext Loop
182 }
183 }
184
185 // Write the Teleport List to a New Notecard
186 osMakeNotecard(CONFIG_DESTINATIONS_NAME, teleport_list);
187}

◆ rdSendHeartbeatMessage()

rdSendHeartbeatMessage ( )

\break Send a heartbeat to the database via the webserver

This message sends a heartbeat command to the program controlling the database. The message contains the following information:

This message serves two purposes. First, it confirms that the teleporter still exists and is operational. Secondly, it confirms, and updates if necessary, the information about the Teleporter.

This information allows the database program to automatically delete destinations where the teleporter and by inference, the regions has disappeared.

Definition at line 202 of file signage_heartbeat.osl.

203{
204 // Do a cursory Check that the configuration has been set up
205 if (database_interface != "")
206 {
207 key messageboard_key = llGetKey();
208 list details = llGetObjectDetails(teleporter_key, [OBJECT_OWNER, OBJECT_GROUP]);
209
210 string heartbeat_message = database_interface + "?command=heartbeat"
211 + "&key=" + messageboard_key
212 + "&owner=" + llList2String(details, 0)
213 + "&group=" + llList2String(details, 1)
214 heartbeat_key = llHTTPRequest(heartbeat_message, [HTTP_BODY_MAXLENGTH,16384], [""]);
215 }
216 else
217 {
218 llSay(DEBUG_CHANNEL, "The database_interface are undefined! Teleporter " + location_name + " has been disabled");
219 llSetScriptState(llGetScriptName(), FALSE);
220 }
221}
string database_interface
The address of the database interface.
key heartbeat_key
The Heatbeat HTTP Requrest Key.

References database_interface, and heartbeat_key.

Variable Documentation

◆ COMMENT_PREAMBLE

string COMMENT_PREAMBLE = "//"

Preamble for a comment line in the configuration file.

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

Definition at line 44 of file signage_heartbeat.osl.

◆ COMMENT_PREAMBLE_LENGTH

integer COMMENT_PREAMBLE_LENGTH = 2

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

Definition at line 51 of file signage_heartbeat.osl.

◆ CONFIG_NOTECARD_NAME

string CONFIG_NOTECARD_NAME = "brigadoon_signage.config"

Script(s) Configuration Notecard.

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

Definition at line 36 of file signage_heartbeat.osl.

◆ DATABASE_INTERFACE

string DATABASE_INTERFACE = "DATABASE_INTERFACE"

The Configuration File Identifier for the Database Interface URL.

Definition at line 57 of file signage_heartbeat.osl.

◆ database_interface

string database_interface

The address of the database interface.

Definition at line 96 of file signage_heartbeat.osl.

Referenced by rdSendHeartbeatMessage().

◆ heartbeat_key

key heartbeat_key

The Heatbeat HTTP Requrest Key.

Definition at line 90 of file signage_heartbeat.osl.

Referenced by rdSendHeartbeatMessage().

◆ HEARTBEAT_PERIOD

string HEARTBEAT_PERIOD = "HEARTBEAT_PERIOD"

The Configuration File Identifier for the Heartbeat Period.

Definition at line 63 of file signage_heartbeat.osl.

◆ heartbeat_period

float heartbeat_period

Interval in seconds between Heartbeat messages.

Definition at line 103 of file signage_heartbeat.osl.

◆ MINIMUM_HEARTBEAT_INTERVAL

float MINIMUM_HEARTBEAT_INTERVAL = 600

Definition at line 78 of file signage_heartbeat.osl.

◆ MINIMUM_HEARTBEAT_PERIOD

float MINIMUM_HEARTBEAT_PERIOD = 0.1

The fastest allowable heartbeat.

This is the minimum interval allowed between heartbeats. This is set to prevent the script from flooding the databse webserver with heartbeat messages, in what would essentially be a denial of service attack.

Definition at line 27 of file signage_heartbeat.osl.

◆ MINIMUM_OFFSET

float MINIMUM_OFFSET = 0.5

Minimum allowable offset.

Definition at line 84 of file signage_heartbeat.osl.

◆ TIMER_OFF

float TIMER_OFF = 0.0

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

Definition at line 70 of file signage_heartbeat.osl.

◆ version_number

integer version_number

Version number as integer.

This integer takes the version string like "1.2.3" into a single integer. The integer is calculated using:

(1 * 10000) + (2 * 100) + 3 => 10023

Definition at line 114 of file signage_heartbeat.osl.

◆ VERSION_STRING

string VERSION_STRING = "0.0.1"

Definition at line 17 of file signage_heartbeat.osl.