Project List BRIGADOON-0003
A script to display a project list menu in Open Simulator.
Loading...
Searching...
No Matches
project_list.osl File Reference

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

Go to the source code of this file.

Functions

 UpdateTexture ()
 Update the Face's Texture based on Project list.
void Ready ()

Variables

integer LastUnix
 Last Update Time (Unix timestamp)
integer DestValidCheck
 Validity Check Flag.
integer HasCheckedChanged
integer NextCheck
list DestinationsName
list DestinationsLink
list DestinationsLogo
list DestinationsValid
key CheckRequest
integer DISPLAY_SIDE = 1
integer COLUMNS = 3
integer ROWS = 10
integer ALT_ROWS = ROWS + 8
string SOURCE_URL = "https://www.little-sense.au/"
string LOGO = "images/Brigadoon_Logo_Small.png"
string FAILURE = "images/question_mark.png"
string NO_LOGO = "images/no_logo.png"
string BLANK_LOGO = "images/blank_label.png"
string FILE_DIRECTORY = "project_dynamic/"

Detailed Description

SCript to send a Heartbeat signal to the Teleport Database.

Version
1.0.0
Date
01 January 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

Theis script takes a list of projects and a hyperlink to documentation and displays a table on the face of an object. If a cell of the table is touched, the script will attempt to open the hyperlink in a browser.

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

Function Documentation

◆ Ready()

void Ready ( )

Definition at line 221 of file project_list.osl.

224{
225 state_entry()
226 {
227 LastUnix = llGetUnixTime();
228 DestValidCheck = 0;
229 NextCheck = -1;
230 HasCheckedChanged = FALSE;
231 CheckRequest = llHTTPRequest(llList2String(DestinationsLink, DestValidCheck), [HTTP_METHOD, "GET"], "");
232 llSetTimerEvent(10);
233 }
234
235 http_response(key Dummy, integer Status, list Meta, string Body)
236 {
237 if (Dummy != CheckRequest)
238 {return;}
239 llSetText(".", <1, 0, 0>, 1);
240 if (Status == 200)
241 {
242 if (llList2Integer(DestinationsValid, DestValidCheck) == FALSE)
243 {HasCheckedChanged = TRUE;}
245 }
246 else
247 {
248 if (llList2Integer(DestinationsValid, DestValidCheck) == TRUE)
249 {HasCheckedChanged = TRUE;}
251 }
253 if (DestValidCheck > llGetListLength(DestinationsLink) - 1)
254 {
256 {UpdateTexture();}
257 NextCheck = llGetUnixTime();
258 llSetText("", <1, 0, 0>, 1);
259 return;
260 }
261 llSleep(1);
262 CheckRequest = llHTTPRequest(llList2String(DestinationsLink, DestValidCheck), [HTTP_METHOD, "GET"], "");
263 }
264
265 timer()
266 {
267 if (LastUnix + 3600 * 4 < llGetUnixTime())
268 {state default;}
269 if (NextCheck != -1 && NextCheck + 90 < llGetUnixTime())
270 {
271 NextCheck = -1;
272 DestValidCheck = 0;
273 HasCheckedChanged = FALSE;
274 CheckRequest = llHTTPRequest(llList2String(DestinationsLink, DestValidCheck), [HTTP_METHOD, "GET"], "");
275 }
276 }
277
278
279 touch_start(integer Dummy)
280 {
281 vector point = llDetectedTouchST(0);
282 integer face = llDetectedTouchFace(0);
283 integer link = llDetectedLinkNumber(0);
284
285// if (link != LINK_ROOT)
286// {return;}
287 if (point == TOUCH_INVALID_TEXCOORD)
288 {return;}
289 if (face != DISPLAY_SIDE)
290 {return;}
291
292 //integer y = (ALT_ROWS - 1) - llFloor(point.y * ALT_ROWS);
293 integer y = (ROWS - 1) - llFloor(point.y * ROWS);
294 integer x = llFloor(point.x * COLUMNS);
295 integer index = (y + x * ROWS);
296
297 if (llList2String(DestinationsLink, index) == "")
298 {return;}
299
300 if (llList2Integer(DestinationsValid, index) == TRUE)
301 {
302 key id = llDetectedKey(0);
303 string info = "Dummy Information";
304 llLoadURL(id, info, llList2String(DestinationsLink, index));
305 }
306 else
307 {
308 llDialog(llDetectedKey(0), "This link is invalid.", ["Ok"], -5);
309 }
310 }
311}
list DestinationsLink
integer DISPLAY_SIDE
integer ROWS
integer DestValidCheck
Validity Check Flag.
list DestinationsValid
UpdateTexture()
Update the Face's Texture based on Project list.
integer COLUMNS
key CheckRequest
integer LastUnix
Last Update Time (Unix timestamp)
integer NextCheck
integer HasCheckedChanged

References CheckRequest, COLUMNS, DestinationsLink, DestinationsValid, DestValidCheck, DISPLAY_SIDE, HasCheckedChanged, LastUnix, NextCheck, ROWS, and UpdateTexture().

Here is the call graph for this function:

◆ UpdateTexture()

UpdateTexture ( )

Update the Face's Texture based on Project list.

Definition at line 57 of file project_list.osl.

58{
59 integer TEXTURE_SIZE = 512;
60 integer FONT_SIZE = (TEXTURE_SIZE / ROWS) / 5;
61
62
63 string drawList;
64 drawList = osSetPenSize(drawList, 1);
65 drawList = osSetFontSize(drawList, FONT_SIZE);
66
67 drawList = osMovePen(drawList, 0, 0);
68 drawList = osSetPenColor(drawList, "Gray");
69 drawList = osDrawFilledRectangle(drawList, TEXTURE_SIZE, TEXTURE_SIZE);
70
71 integer x;
72 integer y;
73 string Logo;
74
75 // Step through the Column in the Display
76 for (x = 0; x < COLUMNS; x++)
77 {
78 // Step through the rows in each column
79 for (y = 0; y < ROWS; y++)
80 {
81 //Calculate the Cell Height and Vell Width
82 integer CELL_HEIGHT = TEXTURE_SIZE / (ROWS + 8);
83 integer CELL_WIDTH = TEXTURE_SIZE / COLUMNS;
84
85 // Calculate the Location of the Top Left Cell
86 integer xTopLeft = x * CELL_WIDTH;
87 integer yTopLeft = y * CELL_HEIGHT;
88
89 drawList = osSetPenColor(drawList, "White");
90 drawList = osMovePen(drawList, xTopLeft, yTopLeft);
91 drawList = osDrawRectangle(drawList, CELL_WIDTH, CELL_HEIGHT);
92
93 integer index = (y + x * ROWS);
94 string cellName = llList2String(DestinationsName, index);
95 integer cellValid = llList2Integer(DestinationsValid, index);
96
97 // If the cell is blank, use a blank logo as well
98 string cellBbackground;
99 if (cellName == "")
100 {
101 cellBbackground = "DarkGray";
102 Logo = SOURCE_URL + BLANK_LOGO;
103 }
104
105 // If the Cell is not blank check if it is valid
106 else
107 {
108 // If the Cell valid, give it a blue background and get its Logo
109 if (cellValid)
110 {
111 cellBbackground = "CadetBlue";
112 Logo = llList2String(DestinationsLogo, index);
113 }
114
115 // If the cell is isn't valid, make the background red & set the failed logo.
116 else
117 {
118 cellBbackground = "IndianRed";
119 Logo = SOURCE_URL + FAILURE;
120 }
121 }
122
123 // Fill the Cell with the Background Colour
124 drawList = osSetPenColor(drawList, cellBbackground);
125 drawList = osMovePen(drawList, xTopLeft + 2, yTopLeft + 2);
126 drawList = osDrawFilledRectangle(drawList, CELL_WIDTH - 3, CELL_HEIGHT - 3);
127
128 // Put the Logo onto into the adjacent cell/
129 xTopLeft += 2;
130 yTopLeft += 6;
131 drawList = osSetPenColor(drawList, "Black");
132 drawList = osMovePen(drawList, xTopLeft + 3, yTopLeft + 3);
133 drawList = osDrawImage(drawList, 16,16, Logo);
134
135 // Draw the Cell Name into the call
136 drawList = osMovePen(drawList, xTopLeft + 20, yTopLeft - 1);
137 drawList = osDrawText(drawList, cellName);
138 }
139 }
140
141 // Use the Instructions on the drawList string to draw the cells
142 osSetDynamicTextureDataBlendFace("", "vector", drawList, "alpha:false,width:" + (string)TEXTURE_SIZE + ",height:" + (string)TEXTURE_SIZE, FALSE, 1, 0, 255, DISPLAY_SIDE);
143}
string BLANK_LOGO
string FAILURE
list DestinationsLogo
string SOURCE_URL
list DestinationsName

References BLANK_LOGO, COLUMNS, DestinationsLogo, DestinationsName, DestinationsValid, DISPLAY_SIDE, FAILURE, ROWS, and SOURCE_URL.

Referenced by Ready().

Here is the caller graph for this function:

Variable Documentation

◆ ALT_ROWS

integer ALT_ROWS = ROWS + 8

Definition at line 43 of file project_list.osl.

◆ BLANK_LOGO

string BLANK_LOGO = "images/blank_label.png"

Definition at line 48 of file project_list.osl.

Referenced by UpdateTexture().

◆ CheckRequest

key CheckRequest

Definition at line 38 of file project_list.osl.

Referenced by Ready().

◆ COLUMNS

integer COLUMNS = 3

Definition at line 41 of file project_list.osl.

Referenced by Ready(), and UpdateTexture().

◆ DestinationsLink

list DestinationsLink

Definition at line 35 of file project_list.osl.

Referenced by Ready().

◆ DestinationsLogo

list DestinationsLogo

Definition at line 36 of file project_list.osl.

Referenced by UpdateTexture().

◆ DestinationsName

list DestinationsName

Definition at line 34 of file project_list.osl.

Referenced by UpdateTexture().

◆ DestinationsValid

list DestinationsValid

Definition at line 37 of file project_list.osl.

Referenced by Ready(), and UpdateTexture().

◆ DestValidCheck

integer DestValidCheck

Validity Check Flag.

Definition at line 29 of file project_list.osl.

Referenced by Ready().

◆ DISPLAY_SIDE

integer DISPLAY_SIDE = 1

Definition at line 40 of file project_list.osl.

Referenced by Ready(), and UpdateTexture().

◆ FAILURE

string FAILURE = "images/question_mark.png"

Definition at line 46 of file project_list.osl.

Referenced by UpdateTexture().

◆ FILE_DIRECTORY

string FILE_DIRECTORY = "project_dynamic/"

Definition at line 49 of file project_list.osl.

◆ HasCheckedChanged

integer HasCheckedChanged

Definition at line 32 of file project_list.osl.

Referenced by Ready().

◆ LastUnix

integer LastUnix

Last Update Time (Unix timestamp)

Definition at line 23 of file project_list.osl.

Referenced by Ready().

◆ LOGO

string LOGO = "images/Brigadoon_Logo_Small.png"

Definition at line 45 of file project_list.osl.

◆ NextCheck

integer NextCheck

Definition at line 33 of file project_list.osl.

Referenced by Ready().

◆ NO_LOGO

string NO_LOGO = "images/no_logo.png"

Definition at line 47 of file project_list.osl.

◆ ROWS

integer ROWS = 10

Definition at line 42 of file project_list.osl.

Referenced by Ready(), and UpdateTexture().

◆ SOURCE_URL

string SOURCE_URL = "https://www.little-sense.au/"

Definition at line 44 of file project_list.osl.

Referenced by UpdateTexture().