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 will make Corrade scan for primitives in the vicinity and 5 // This script will make Corrade scan for primitives in the vicinity and
6 // will then offer a dialog for you to pick to which primitive Corrade will 6 // will then offer a dialog for you to pick to which primitive Corrade will
7 // point to. Note that the point effect can only be observed in case the 7 // point to. Note that the point effect can only be observed in case the
Line 11... Line 11...
11 // http://grimore.org/secondlife/scripted_agents/corrade 11 // http://grimore.org/secondlife/scripted_agents/corrade
12 // 12 //
13 /////////////////////////////////////////////////////////////////////////// 13 ///////////////////////////////////////////////////////////////////////////
Line 14... Line 14...
14   14  
15 /////////////////////////////////////////////////////////////////////////// 15 ///////////////////////////////////////////////////////////////////////////
16 // Copyright (C) 2014 Wizardry and Steamworks - License: GNU GPLv3 // 16 // Copyright (C) 2014 Wizardry and Steamworks - License: CC BY 2.0 //
17 /////////////////////////////////////////////////////////////////////////// 17 ///////////////////////////////////////////////////////////////////////////
18 string wasKeyValueGet(string k, string data) { 18 string wasKeyValueGet(string k, string data) {
19 if(llStringLength(data) == 0) return ""; 19 if(llStringLength(data) == 0) return "";
20 if(llStringLength(k) == 0) return ""; 20 if(llStringLength(k) == 0) return "";
Line 23... Line 23...
23 if(i != -1) return llList2String(a, i+1); 23 if(i != -1) return llList2String(a, i+1);
24 return ""; 24 return "";
25 } 25 }
Line 26... Line 26...
26 26
27 /////////////////////////////////////////////////////////////////////////// 27 ///////////////////////////////////////////////////////////////////////////
28 // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // 28 // Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 //
29 /////////////////////////////////////////////////////////////////////////// 29 ///////////////////////////////////////////////////////////////////////////
30 string wasKeyValueEncode(list data) { 30 string wasKeyValueEncode(list data) {
31 list k = llList2ListStrided(data, 0, -1, 2); 31 list k = llList2ListStrided(data, 0, -1, 2);
32 list v = llList2ListStrided(llDeleteSubList(data, 0, 0), 0, -1, 2); 32 list v = llList2ListStrided(llDeleteSubList(data, 0, 0), 0, -1, 2);
Line 38... Line 38...
38 } while(llGetListLength(k) != 0); 38 } while(llGetListLength(k) != 0);
39 return llDumpList2String(data, "&"); 39 return llDumpList2String(data, "&");
40 } 40 }
Line 41... Line 41...
41   41  
42 /////////////////////////////////////////////////////////////////////////// 42 ///////////////////////////////////////////////////////////////////////////
43 // Copyright (C) 2011 Wizardry and Steamworks - License: GNU GPLv3 // 43 // Copyright (C) 2011 Wizardry and Steamworks - License: CC BY 2.0 //
44 /////////////////////////////////////////////////////////////////////////// 44 ///////////////////////////////////////////////////////////////////////////
45 // http://was.fm/secondlife/wanderer 45 // http://was.fm/secondlife/wanderer
46 vector wasCirclePoint(float radius) { 46 vector wasCirclePoint(float radius) {
47 float x = llPow(-1, 1 + (integer) llFrand(2)) * llFrand(radius*2); 47 float x = llPow(-1, 1 + (integer) llFrand(2)) * llFrand(radius*2);
Line 50... Line 50...
50 return <x, y, 0>; 50 return <x, y, 0>;
51 return wasCirclePoint(radius); 51 return wasCirclePoint(radius);
52 } 52 }
Line 53... Line 53...
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 // escapes a string in conformance with RFC1738 57 // escapes a string in conformance with RFC1738
58 string wasURLEscape(string i) { 58 string wasURLEscape(string i) {
59 string o = ""; 59 string o = "";
Line 74... Line 74...
74 } while(i != ""); 74 } while(i != "");
75 return o; 75 return o;
76 } 76 }
Line 77... Line 77...
77   77  
78 /////////////////////////////////////////////////////////////////////////// 78 ///////////////////////////////////////////////////////////////////////////
79 // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // 79 // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 //
80 /////////////////////////////////////////////////////////////////////////// 80 ///////////////////////////////////////////////////////////////////////////
81 list wasCSVToList(string csv) { 81 list wasCSVToList(string csv) {
82 list l = []; 82 list l = [];
83 list s = []; 83 list s = [];
Line 113... Line 113...
113 // postcondition: length(s) = 0 113 // postcondition: length(s) = 0
114 return l + m; 114 return l + m;
115 } 115 }
Line 116... Line 116...
116   116  
117 /////////////////////////////////////////////////////////////////////////// 117 ///////////////////////////////////////////////////////////////////////////
118 // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // 118 // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 //
119 /////////////////////////////////////////////////////////////////////////// 119 ///////////////////////////////////////////////////////////////////////////
120 string wasListToCSV(list l) { 120 string wasListToCSV(list l) {
121 list v = []; 121 list v = [];
122 do { 122 do {
Line 142... Line 142...
142 } while(l != []); 142 } while(l != []);
143 return llDumpList2String(v, ","); 143 return llDumpList2String(v, ",");
144 } 144 }
Line 145... Line 145...
145   145  
146 /////////////////////////////////////////////////////////////////////////// 146 ///////////////////////////////////////////////////////////////////////////
147 // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // 147 // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 //
148 /////////////////////////////////////////////////////////////////////////// 148 ///////////////////////////////////////////////////////////////////////////
149 // unescapes a string in conformance with RFC1738 149 // unescapes a string in conformance with RFC1738
150 string wasURLUnescape(string i) { 150 string wasURLUnescape(string i) {
151 return llUnescapeURL( 151 return llUnescapeURL(
Line 166... Line 166...
166 ) 166 )
167 ); 167 );
168 } 168 }
Line 169... Line 169...
169   169  
170 /////////////////////////////////////////////////////////////////////////// 170 ///////////////////////////////////////////////////////////////////////////
171 // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // 171 // Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 //
172 /////////////////////////////////////////////////////////////////////////// 172 ///////////////////////////////////////////////////////////////////////////
173 integer wasMenuIndex = 0; 173 integer wasMenuIndex = 0;
174 list wasDialogMenu(list input, list actions, string direction) { 174 list wasDialogMenu(list input, list actions, string direction) {
175 integer cut = 11-wasListCountExclude(actions, [""]); 175 integer cut = 11-wasListCountExclude(actions, [""]);
Line 187... Line 187...
187 input = wasListMerge(input, actions, ""); 187 input = wasListMerge(input, actions, "");
188 return input; 188 return input;
189 } 189 }
Line 190... Line 190...
190 190
191 /////////////////////////////////////////////////////////////////////////// 191 ///////////////////////////////////////////////////////////////////////////
192 // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // 192 // Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 //
193 /////////////////////////////////////////////////////////////////////////// 193 ///////////////////////////////////////////////////////////////////////////
194 integer wasListCountExclude(list input, list exclude) { 194 integer wasListCountExclude(list input, list exclude) {
195 if(llGetListLength(input) == 0) return 0; 195 if(llGetListLength(input) == 0) return 0;
196 if(llListFindList(exclude, (list)llList2String(input, 0)) == -1) 196 if(llListFindList(exclude, (list)llList2String(input, 0)) == -1)
197 return 1 + wasListCountExclude(llDeleteSubList(input, 0, 0), exclude); 197 return 1 + wasListCountExclude(llDeleteSubList(input, 0, 0), exclude);
198 return wasListCountExclude(llDeleteSubList(input, 0, 0), exclude); 198 return wasListCountExclude(llDeleteSubList(input, 0, 0), exclude);
Line 199... Line 199...
199 } 199 }
200 200
201 /////////////////////////////////////////////////////////////////////////// 201 ///////////////////////////////////////////////////////////////////////////
202 // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // 202 // Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 //
203 /////////////////////////////////////////////////////////////////////////// 203 ///////////////////////////////////////////////////////////////////////////
204 list wasListMerge(list l, list m, string merge) { 204 list wasListMerge(list l, list m, string merge) {
205 if(llGetListLength(l) == 0 && llGetListLength(m) == 0) return []; 205 if(llGetListLength(l) == 0 && llGetListLength(m) == 0) return [];