corrade-lsl-templates – Diff between revs 5 and 29
?pathlinks?
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 which primitive to touch. |
6 | // will then offer a dialog for you to pick which primitive to touch. |
|
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) 2014 Wizardry and Steamworks - License: GNU GPLv3 // |
14 | // Copyright (C) 2014 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, i+1); |
21 | if(i != -1) return llList2String(a, 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) 2011 Wizardry and Steamworks - License: GNU GPLv3 // |
41 | // Copyright (C) 2011 Wizardry and Steamworks - License: CC BY 2.0 // |
|
42 | /////////////////////////////////////////////////////////////////////////// |
42 | /////////////////////////////////////////////////////////////////////////// |
|
43 | // http://was.fm/secondlife/wanderer |
43 | // http://was.fm/secondlife/wanderer |
|
44 | vector wasCirclePoint(float radius) { |
44 | vector wasCirclePoint(float radius) { |
|
45 | float x = llPow(-1, 1 + (integer) llFrand(2)) * llFrand(radius*2); |
45 | float x = llPow(-1, 1 + (integer) llFrand(2)) * llFrand(radius*2); |
|
Line 48... | Line 48... | |||
48 | return <x, y, 0>; |
48 | return <x, y, 0>; |
|
49 | return wasCirclePoint(radius); |
49 | return wasCirclePoint(radius); |
|
50 | } |
50 | } |
|
Line 51... | Line 51... | |||
51 | |
51 | |
|
52 | /////////////////////////////////////////////////////////////////////////// |
52 | /////////////////////////////////////////////////////////////////////////// |
|
53 | // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
53 | // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
|
54 | /////////////////////////////////////////////////////////////////////////// |
54 | /////////////////////////////////////////////////////////////////////////// |
|
55 | // escapes a string in conformance with RFC1738 |
55 | // escapes a string in conformance with RFC1738 |
|
56 | string wasURLEscape(string i) { |
56 | string wasURLEscape(string i) { |
|
57 | string o = ""; |
57 | string o = ""; |
|
Line 72... | Line 72... | |||
72 | } while(i != ""); |
72 | } while(i != ""); |
|
73 | return o; |
73 | return o; |
|
74 | } |
74 | } |
|
Line 75... | Line 75... | |||
75 | |
75 | |
|
76 | /////////////////////////////////////////////////////////////////////////// |
76 | /////////////////////////////////////////////////////////////////////////// |
|
77 | // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
77 | // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
|
78 | /////////////////////////////////////////////////////////////////////////// |
78 | /////////////////////////////////////////////////////////////////////////// |
|
79 | list wasCSVToList(string csv) { |
79 | list wasCSVToList(string csv) { |
|
80 | list l = []; |
80 | list l = []; |
|
81 | list s = []; |
81 | list s = []; |
|
Line 111... | Line 111... | |||
111 | // postcondition: length(s) = 0 |
111 | // postcondition: length(s) = 0 |
|
112 | return l + m; |
112 | return l + m; |
|
113 | } |
113 | } |
|
Line 114... | Line 114... | |||
114 | |
114 | |
|
115 | /////////////////////////////////////////////////////////////////////////// |
115 | /////////////////////////////////////////////////////////////////////////// |
|
116 | // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
116 | // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
|
117 | /////////////////////////////////////////////////////////////////////////// |
117 | /////////////////////////////////////////////////////////////////////////// |
|
118 | string wasListToCSV(list l) { |
118 | string wasListToCSV(list l) { |
|
119 | list v = []; |
119 | list v = []; |
|
120 | do { |
120 | do { |
|
Line 140... | Line 140... | |||
140 | } while(l != []); |
140 | } while(l != []); |
|
141 | return llDumpList2String(v, ","); |
141 | return llDumpList2String(v, ","); |
|
142 | } |
142 | } |
|
Line 143... | Line 143... | |||
143 | |
143 | |
|
144 | /////////////////////////////////////////////////////////////////////////// |
144 | /////////////////////////////////////////////////////////////////////////// |
|
145 | // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
145 | // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 // |
|
146 | /////////////////////////////////////////////////////////////////////////// |
146 | /////////////////////////////////////////////////////////////////////////// |
|
147 | // unescapes a string in conformance with RFC1738 |
147 | // unescapes a string in conformance with RFC1738 |
|
148 | string wasURLUnescape(string i) { |
148 | string wasURLUnescape(string i) { |
|
149 | return llUnescapeURL( |
149 | return llUnescapeURL( |
|
Line 164... | Line 164... | |||
164 | ) |
164 | ) |
|
165 | ); |
165 | ); |
|
166 | } |
166 | } |
|
Line 167... | Line 167... | |||
167 | |
167 | |
|
168 | /////////////////////////////////////////////////////////////////////////// |
168 | /////////////////////////////////////////////////////////////////////////// |
|
169 | // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // |
169 | // Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 // |
|
170 | /////////////////////////////////////////////////////////////////////////// |
170 | /////////////////////////////////////////////////////////////////////////// |
|
171 | integer wasMenuIndex = 0; |
171 | integer wasMenuIndex = 0; |
|
172 | list wasDialogMenu(list input, list actions, string direction) { |
172 | list wasDialogMenu(list input, list actions, string direction) { |
|
173 | integer cut = 11-wasListCountExclude(actions, [""]); |
173 | integer cut = 11-wasListCountExclude(actions, [""]); |
|
Line 185... | Line 185... | |||
185 | input = wasListMerge(input, actions, ""); |
185 | input = wasListMerge(input, actions, ""); |
|
186 | return input; |
186 | return input; |
|
187 | } |
187 | } |
|
Line 188... | Line 188... | |||
188 | |
188 | |
|
189 | /////////////////////////////////////////////////////////////////////////// |
189 | /////////////////////////////////////////////////////////////////////////// |
|
190 | // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // |
190 | // Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 // |
|
191 | /////////////////////////////////////////////////////////////////////////// |
191 | /////////////////////////////////////////////////////////////////////////// |
|
192 | integer wasListCountExclude(list input, list exclude) { |
192 | integer wasListCountExclude(list input, list exclude) { |
|
193 | if(llGetListLength(input) == 0) return 0; |
193 | if(llGetListLength(input) == 0) return 0; |
|
194 | if(llListFindList(exclude, (list)llList2String(input, 0)) == -1) |
194 | if(llListFindList(exclude, (list)llList2String(input, 0)) == -1) |
|
195 | return 1 + wasListCountExclude(llDeleteSubList(input, 0, 0), exclude); |
195 | return 1 + wasListCountExclude(llDeleteSubList(input, 0, 0), exclude); |
|
196 | return wasListCountExclude(llDeleteSubList(input, 0, 0), exclude); |
196 | return wasListCountExclude(llDeleteSubList(input, 0, 0), exclude); |
|
Line 197... | Line 197... | |||
197 | } |
197 | } |
|
198 | |
198 | |
|
199 | /////////////////////////////////////////////////////////////////////////// |
199 | /////////////////////////////////////////////////////////////////////////// |
|
200 | // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // |
200 | // Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 // |
|
201 | /////////////////////////////////////////////////////////////////////////// |
201 | /////////////////////////////////////////////////////////////////////////// |
|
202 | list wasListMerge(list l, list m, string merge) { |
202 | list wasListMerge(list l, list m, string merge) { |
|
203 | if(llGetListLength(l) == 0 && llGetListLength(m) == 0) return []; |
203 | if(llGetListLength(l) == 0 && llGetListLength(m) == 0) return []; |