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