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 2016 - License: GNU GPLv3 // 2 // Copyright (C) Wizardry and Steamworks 2016 - License: CC BY 2.0 //
3 /////////////////////////////////////////////////////////////////////////// 3 ///////////////////////////////////////////////////////////////////////////
4 // 4 //
5 // This script is able to send messages to avatars, groups or talk in local 5 // This script is able to send messages to avatars, groups or talk in local
6 // using Corrade. 6 // using Corrade.
7 // 7 //
Line 9... Line 9...
9 // http://grimore.org/secondlife/scripted_agents/corrade 9 // http://grimore.org/secondlife/scripted_agents/corrade
10 // 10 //
11 /////////////////////////////////////////////////////////////////////////// 11 ///////////////////////////////////////////////////////////////////////////
Line 12... Line 12...
12   12  
13 /////////////////////////////////////////////////////////////////////////// 13 ///////////////////////////////////////////////////////////////////////////
14 // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // 14 // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 //
15 /////////////////////////////////////////////////////////////////////////// 15 ///////////////////////////////////////////////////////////////////////////
16 string wasKeyValueGet(string k, string data) { 16 string wasKeyValueGet(string k, string data) {
17 if(llStringLength(data) == 0) return ""; 17 if(llStringLength(data) == 0) return "";
18 if(llStringLength(k) == 0) return ""; 18 if(llStringLength(k) == 0) return "";
Line 21... Line 21...
21 if(i != -1) return llList2String(a, 2*i+1); 21 if(i != -1) return llList2String(a, 2*i+1);
22 return ""; 22 return "";
23 } 23 }
Line 24... Line 24...
24 24
25 /////////////////////////////////////////////////////////////////////////// 25 ///////////////////////////////////////////////////////////////////////////
26 // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // 26 // Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 //
27 /////////////////////////////////////////////////////////////////////////// 27 ///////////////////////////////////////////////////////////////////////////
28 string wasKeyValueEncode(list data) { 28 string wasKeyValueEncode(list data) {
29 list k = llList2ListStrided(data, 0, -1, 2); 29 list k = llList2ListStrided(data, 0, -1, 2);
30 list v = llList2ListStrided(llDeleteSubList(data, 0, 0), 0, -1, 2); 30 list v = llList2ListStrided(llDeleteSubList(data, 0, 0), 0, -1, 2);
Line 36... Line 36...
36 } while(llGetListLength(k) != 0); 36 } while(llGetListLength(k) != 0);
37 return llDumpList2String(data, "&"); 37 return llDumpList2String(data, "&");
38 } 38 }
Line 39... Line 39...
39   39  
40 /////////////////////////////////////////////////////////////////////////// 40 ///////////////////////////////////////////////////////////////////////////
41 // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // 41 // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 //
42 /////////////////////////////////////////////////////////////////////////// 42 ///////////////////////////////////////////////////////////////////////////
43 // escapes a string in conformance with RFC1738 43 // escapes a string in conformance with RFC1738
44 string wasURLEscape(string i) { 44 string wasURLEscape(string i) {
45 string o = ""; 45 string o = "";
Line 60... Line 60...
60 } while(i != ""); 60 } while(i != "");
61 return o; 61 return o;
62 } 62 }
Line 63... Line 63...
63   63  
64 /////////////////////////////////////////////////////////////////////////// 64 ///////////////////////////////////////////////////////////////////////////
65 // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // 65 // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 //
66 /////////////////////////////////////////////////////////////////////////// 66 ///////////////////////////////////////////////////////////////////////////
67 list wasCSVToList(string csv) { 67 list wasCSVToList(string csv) {
68 list l = []; 68 list l = [];
69 list s = []; 69 list s = [];
Line 99... Line 99...
99 // postcondition: length(s) = 0 99 // postcondition: length(s) = 0
100 return l + m; 100 return l + m;
101 } 101 }
Line 102... Line 102...
102   102  
103 /////////////////////////////////////////////////////////////////////////// 103 ///////////////////////////////////////////////////////////////////////////
104 // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // 104 // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 //
105 /////////////////////////////////////////////////////////////////////////// 105 ///////////////////////////////////////////////////////////////////////////
106 string wasListToCSV(list l) { 106 string wasListToCSV(list l) {
107 list v = []; 107 list v = [];
108 do { 108 do {
Line 128... Line 128...
128 } while(l != []); 128 } while(l != []);
129 return llDumpList2String(v, ","); 129 return llDumpList2String(v, ",");
130 } 130 }
Line 131... Line 131...
131   131  
132 /////////////////////////////////////////////////////////////////////////// 132 ///////////////////////////////////////////////////////////////////////////
133 // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // 133 // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 //
134 /////////////////////////////////////////////////////////////////////////// 134 ///////////////////////////////////////////////////////////////////////////
135 // unescapes a string in conformance with RFC1738 135 // unescapes a string in conformance with RFC1738
136 string wasURLUnescape(string i) { 136 string wasURLUnescape(string i) {
137 return llUnescapeURL( 137 return llUnescapeURL(
Line 153... Line 153...
153 ); 153 );
154 } 154 }
Line 155... Line 155...
155   155  
156   156  
157 /////////////////////////////////////////////////////////////////////////// 157 ///////////////////////////////////////////////////////////////////////////
158 // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // 158 // Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 //
159 /////////////////////////////////////////////////////////////////////////// 159 ///////////////////////////////////////////////////////////////////////////
160 integer wasMenuIndex = 0; 160 integer wasMenuIndex = 0;
161 list wasDialogMenu(list input, list actions, string direction) { 161 list wasDialogMenu(list input, list actions, string direction) {
Line 174... Line 174...
174 input = wasListMerge(input, actions, ""); 174 input = wasListMerge(input, actions, "");
175 return input; 175 return input;
176 } 176 }
Line 177... Line 177...
177 177
178 /////////////////////////////////////////////////////////////////////////// 178 ///////////////////////////////////////////////////////////////////////////
179 // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // 179 // Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 //
180 /////////////////////////////////////////////////////////////////////////// 180 ///////////////////////////////////////////////////////////////////////////
181 integer wasListCountExclude(list input, list exclude) { 181 integer wasListCountExclude(list input, list exclude) {
182 if(llGetListLength(input) == 0) return 0; 182 if(llGetListLength(input) == 0) return 0;
183 if(llListFindList(exclude, (list)llList2String(input, 0)) == -1) 183 if(llListFindList(exclude, (list)llList2String(input, 0)) == -1)
184 return 1 + wasListCountExclude(llDeleteSubList(input, 0, 0), exclude); 184 return 1 + wasListCountExclude(llDeleteSubList(input, 0, 0), exclude);
185 return wasListCountExclude(llDeleteSubList(input, 0, 0), exclude); 185 return wasListCountExclude(llDeleteSubList(input, 0, 0), exclude);
Line 186... Line 186...
186 } 186 }
187 187
188 /////////////////////////////////////////////////////////////////////////// 188 ///////////////////////////////////////////////////////////////////////////
189 // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // 189 // Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 //
190 /////////////////////////////////////////////////////////////////////////// 190 ///////////////////////////////////////////////////////////////////////////
191 list wasListMerge(list l, list m, string merge) { 191 list wasListMerge(list l, list m, string merge) {
192 if(llGetListLength(l) == 0 && llGetListLength(m) == 0) return []; 192 if(llGetListLength(l) == 0 && llGetListLength(m) == 0) return [];