corrade-lsl-templates – Diff between revs 5 and 29

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 5 Rev 29
Line 1... Line 1...
1 /////////////////////////////////////////////////////////////////////////// 1 ///////////////////////////////////////////////////////////////////////////
2 // Copyright (C) Wizardry and Steamworks 2014 - License: GNU GPLv3 // 2 // Copyright (C) Wizardry and Steamworks 2014 - License: CC BY 2.0 //
3 /////////////////////////////////////////////////////////////////////////// 3 ///////////////////////////////////////////////////////////////////////////
4 // 4 //
5 // This is a device meant to scan regions and show metrics for the Corrade 5 // This is a device meant to scan regions and show metrics for the Corrade
6 // Second Life / OpenSim bot. You can find more details about the bot 6 // Second Life / OpenSim bot. You can find more details about the bot
7 // by following the URL: http://was.fm/secondlife/scripted_agents/corrade 7 // by following the URL: http://was.fm/secondlife/scripted_agents/corrade
8 // 8 //
9 // The script works in conjunction with a "configuration" notecard and a 9 // The script works in conjunction with a "configuration" notecard and a
10 // "regions" notecard that must both be placed in the same primitive. 10 // "regions" notecard that must both be placed in the same primitive.
11 // The purpose of this script is to demonstrate scanning with Corrade and 11 // The purpose of this script is to demonstrate scanning with Corrade and
12 // you are free to use, change, and commercialize it under the GNU/GPLv3 12 // you are free to use, change, and commercialize it under the CC BY 2.0
13 // license at: http://www.gnu.org/licenses/gpl.html 13 // license at: https://creativecommons.org/licenses/by/2.0
14 // 14 //
15 /////////////////////////////////////////////////////////////////////////// 15 ///////////////////////////////////////////////////////////////////////////
Line 16... Line 16...
16   16  
17 /////////////////////////////////////////////////////////////////////////// 17 ///////////////////////////////////////////////////////////////////////////
18 // Copyright (C) 2014 Wizardry and Steamworks - License: GNU GPLv3 // 18 // Copyright (C) 2014 Wizardry and Steamworks - License: CC BY 2.0 //
19 /////////////////////////////////////////////////////////////////////////// 19 ///////////////////////////////////////////////////////////////////////////
20 string wasKeyValueGet(string k, string data) { 20 string wasKeyValueGet(string k, string data) {
21 if(llStringLength(data) == 0) return ""; 21 if(llStringLength(data) == 0) return "";
22 if(llStringLength(k) == 0) return ""; 22 if(llStringLength(k) == 0) return "";
Line 25... Line 25...
25 if(i != -1) return llList2String(a, i+1); 25 if(i != -1) return llList2String(a, i+1);
26 return ""; 26 return "";
27 } 27 }
Line 28... Line 28...
28 28
29 /////////////////////////////////////////////////////////////////////////// 29 ///////////////////////////////////////////////////////////////////////////
30 // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // 30 // Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 //
31 /////////////////////////////////////////////////////////////////////////// 31 ///////////////////////////////////////////////////////////////////////////
32 string wasKeyValueEncode(list data) { 32 string wasKeyValueEncode(list data) {
33 list k = llList2ListStrided(data, 0, -1, 2); 33 list k = llList2ListStrided(data, 0, -1, 2);
34 list v = llList2ListStrided(llDeleteSubList(data, 0, 0), 0, -1, 2); 34 list v = llList2ListStrided(llDeleteSubList(data, 0, 0), 0, -1, 2);
Line 40... Line 40...
40 } while(llGetListLength(k) != 0); 40 } while(llGetListLength(k) != 0);
41 return llDumpList2String(data, "&"); 41 return llDumpList2String(data, "&");
42 } 42 }
Line 43... Line 43...
43   43  
44 /////////////////////////////////////////////////////////////////////////// 44 ///////////////////////////////////////////////////////////////////////////
45 // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // 45 // Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 //
46 /////////////////////////////////////////////////////////////////////////// 46 ///////////////////////////////////////////////////////////////////////////
47 integer wasListCountExclude(list input, list exclude) { 47 integer wasListCountExclude(list input, list exclude) {
48 if(llGetListLength(input) == 0) return 0; 48 if(llGetListLength(input) == 0) return 0;
49 if(llListFindList(exclude, (list)llList2String(input, 0)) == -1) 49 if(llListFindList(exclude, (list)llList2String(input, 0)) == -1)
50 return 1 + wasListCountExclude(llDeleteSubList(input, 0, 0), exclude); 50 return 1 + wasListCountExclude(llDeleteSubList(input, 0, 0), exclude);
51 return wasListCountExclude(llDeleteSubList(input, 0, 0), exclude); 51 return wasListCountExclude(llDeleteSubList(input, 0, 0), exclude);
Line 52... Line 52...
52 } 52 }
53   53  
54 /////////////////////////////////////////////////////////////////////////// 54 ///////////////////////////////////////////////////////////////////////////
55 // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // 55 // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 //
56 /////////////////////////////////////////////////////////////////////////// 56 ///////////////////////////////////////////////////////////////////////////
57 string wasListToCSV(list l) { 57 string wasListToCSV(list l) {
58 list v = []; 58 list v = [];
Line 75... Line 75...
75 } while(l != []); 75 } while(l != []);
76 return llDumpList2String(v, ","); 76 return llDumpList2String(v, ",");
77 } 77 }
Line 78... Line 78...
78   78  
79 /////////////////////////////////////////////////////////////////////////// 79 ///////////////////////////////////////////////////////////////////////////
80 // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // 80 // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 //
81 /////////////////////////////////////////////////////////////////////////// 81 ///////////////////////////////////////////////////////////////////////////
82 list wasCSVToList(string csv) { 82 list wasCSVToList(string csv) {
83 list l = []; 83 list l = [];
84 list s = []; 84 list s = [];
Line 114... Line 114...
114 // invariant: length(s) = 0 114 // invariant: length(s) = 0
115 return l + m; 115 return l + m;
116 } 116 }
Line 117... Line 117...
117   117  
118 /////////////////////////////////////////////////////////////////////////// 118 ///////////////////////////////////////////////////////////////////////////
119 // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // 119 // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 //
120 /////////////////////////////////////////////////////////////////////////// 120 ///////////////////////////////////////////////////////////////////////////
121 // escapes a string in conformance with RFC1738 121 // escapes a string in conformance with RFC1738
122 string wasURLEscape(string i) { 122 string wasURLEscape(string i) {
123 string o = ""; 123 string o = "";
Line 138... Line 138...
138 } while(i != ""); 138 } while(i != "");
139 return o; 139 return o;
140 } 140 }
Line 141... Line 141...
141   141  
142 /////////////////////////////////////////////////////////////////////////// 142 ///////////////////////////////////////////////////////////////////////////
143 // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // 143 // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 //
144 /////////////////////////////////////////////////////////////////////////// 144 ///////////////////////////////////////////////////////////////////////////
145 // unescapes a string in conformance with RFC1738 145 // unescapes a string in conformance with RFC1738
146 string wasURLUnescape(string i) { 146 string wasURLUnescape(string i) {
147 return llUnescapeURL( 147 return llUnescapeURL(