corrade-lsl-templates – Diff between revs 29 and 33
?pathlinks?
Rev 29 | Rev 33 | |||
---|---|---|---|---|
Line 5... | Line 5... | |||
5 | // A module that sends the current Corrade heartbeat to group chat. |
5 | // A module that sends the current Corrade heartbeat to group chat. |
|
6 | // |
6 | // |
|
7 | /////////////////////////////////////////////////////////////////////////// |
7 | /////////////////////////////////////////////////////////////////////////// |
|
Line 8... | Line 8... | |||
8 | |
8 | |
|
9 | /////////////////////////////////////////////////////////////////////////// |
9 | /////////////////////////////////////////////////////////////////////////// |
|
10 | // Copyright (C) 2014 Wizardry and Steamworks - License: CC BY 2.0 // |
10 | // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
|
11 | /////////////////////////////////////////////////////////////////////////// |
11 | /////////////////////////////////////////////////////////////////////////// |
|
12 | string wasKeyValueGet(string k, string data) { |
12 | string wasKeyValueGet(string k, string data) { |
|
13 | if(llStringLength(data) == 0) return ""; |
13 | if(llStringLength(data) == 0) return ""; |
|
14 | if(llStringLength(k) == 0) return ""; |
14 | if(llStringLength(k) == 0) return ""; |
|
15 | list a = llParseString2List(data, ["&", "="], []); |
15 | list a = llParseString2List(data, ["&", "="], []); |
|
16 | integer i = llListFindList(a, [ k ]); |
16 | integer i = llListFindList(llList2ListStrided(a, 0, -1, 2), [ k ]); |
|
17 | if(i != -1) return llList2String(a, i+1); |
17 | if(i != -1) return llList2String(a, 2*i+1); |
|
18 | return ""; |
18 | return ""; |
|
Line 19... | Line 19... | |||
19 | } |
19 | } |
|
20 | |
20 | |
|
Line 219... | Line 219... | |||
219 | // We only care about notifications now. |
219 | // We only care about notifications now. |
|
220 | if(id != "notification") |
220 | if(id != "notification") |
|
221 | return; |
221 | return; |
|
Line 222... | Line 222... | |||
222 | |
222 | |
|
223 | // This script only processes group notifications. |
223 | // This script only processes group notifications. |
|
- | 224 | if(wasKeyValueGet("type", message) != "group" || |
||
- | 225 | (wasKeyValueGet("type", message) == "group" && |
||
- | 226 | wasURLUnescape(wasKeyValueGet("group", message)) != |
||
224 | if(wasKeyValueGet("type", message) != "group") |
227 | wasKeyValueGet("group", configuration))) |
|
Line 225... | Line 228... | |||
225 | return; |
228 | return; |
|
226 | |
229 | |
|
227 | // Get the sent message. |
230 | // Get the sent message. |
|
Line 311... | Line 314... | |||
311 | ) |
314 | ) |
|
312 | ), |
315 | ), |
|
313 | "data", wasListToCSV( |
316 | "data", wasListToCSV( |
|
314 | [ |
317 | [ |
|
315 | "AverageCPUUsage", |
318 | "AverageCPUUsage", |
|
316 | "AverageRAMUsage" |
319 | "AverageRAMUsage", |
|
- | 320 | "Uptime" |
||
317 | ] |
321 | ] |
|
318 | ), |
322 | ), |
|
319 | "callback", wasURLEscape(URL) |
323 | "callback", wasURLEscape(URL) |
|
320 | ] |
324 | ] |
|
321 | ) |
325 | ) |
|
Line 363... | Line 367... | |||
363 | ["AverageRAMUsage"] |
367 | ["AverageRAMUsage"] |
|
364 | ) + 1 |
368 | ) + 1 |
|
365 | ) / 1024 / 1024 |
369 | ) / 1024 / 1024 |
|
366 | ); |
370 | ); |
|
Line -... | Line 371... | |||
- | 371 | |
||
- | 372 | string uptime = llList2String( |
||
- | 373 | stats, |
||
- | 374 | llListFindList( |
||
- | 375 | stats, |
||
- | 376 | ["Uptime"] |
||
- | 377 | ) + 1 |
||
- | 378 | ); |
||
367 | |
379 | |
|
Line 368... | Line 380... | |||
368 | data = "RAM: " + RAM + "MiB" + " CPU: " + CPU + "%"; |
380 | data = "RAM: " + RAM + "MiB" + " CPU: " + CPU + "%" + " Uptime: " + uptime; |
|
369 | |
381 | |
|
370 | state tell; |
382 | state tell; |
|
371 | } |
383 | } |