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 menu selector for the Corrade bot that is capable of replying 5 // This is a menu selector for the Corrade bot that is capable of replying
6 // to dialog requests while supporting several nested levels of menus. You 6 // to dialog requests while supporting several nested levels of menus. You
7 // can find out more about the Corrade bot by following the URL: 7 // can find out more about the Corrade bot by following the URL:
8 // http://was.fm/secondlife/scripted_agents/corrade 8 // http://was.fm/secondlife/scripted_agents/corrade
9 // 9 //
10 // The sit script works together with a "configuration" notecard that must 10 // The sit script works together with a "configuration" notecard that must
11 // be placed in the same primitive as this script. The purpose of this 11 // be placed in the same primitive as this script. The purpose of this
12 // script is to demonstrate answering dialogs with Corrade and you are free 12 // script is to demonstrate answering dialogs with Corrade and you are free
13 // to use, change, and commercialize it under the GNU/GPLv3 license at: 13 // to use, change, and commercialize it under the CC BY 2.0 license at:
14 // http://www.gnu.org/licenses/gpl.html 14 // https://creativecommons.org/licenses/by/2.0
15 // 15 //
16 /////////////////////////////////////////////////////////////////////////// 16 ///////////////////////////////////////////////////////////////////////////
Line 17... Line 17...
17   17  
18 /////////////////////////////////////////////////////////////////////////// 18 ///////////////////////////////////////////////////////////////////////////
19 // Copyright (C) 2014 Wizardry and Steamworks - License: GNU GPLv3 // 19 // Copyright (C) 2014 Wizardry and Steamworks - License: CC BY 2.0 //
20 /////////////////////////////////////////////////////////////////////////// 20 ///////////////////////////////////////////////////////////////////////////
21 string wasKeyValueGet(string k, string data) { 21 string wasKeyValueGet(string k, string data) {
22 if(llStringLength(data) == 0) return ""; 22 if(llStringLength(data) == 0) return "";
23 if(llStringLength(k) == 0) return ""; 23 if(llStringLength(k) == 0) return "";
Line 26... Line 26...
26 if(i != -1) return llList2String(a, i+1); 26 if(i != -1) return llList2String(a, i+1);
27 return ""; 27 return "";
28 } 28 }
Line 29... Line 29...
29 29
30 /////////////////////////////////////////////////////////////////////////// 30 ///////////////////////////////////////////////////////////////////////////
31 // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // 31 // Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 //
32 /////////////////////////////////////////////////////////////////////////// 32 ///////////////////////////////////////////////////////////////////////////
33 string wasKeyValueEncode(list data) { 33 string wasKeyValueEncode(list data) {
34 list k = llList2ListStrided(data, 0, -1, 2); 34 list k = llList2ListStrided(data, 0, -1, 2);
35 list v = llList2ListStrided(llDeleteSubList(data, 0, 0), 0, -1, 2); 35 list v = llList2ListStrided(llDeleteSubList(data, 0, 0), 0, -1, 2);
Line 41... Line 41...
41 } while(llGetListLength(k) != 0); 41 } while(llGetListLength(k) != 0);
42 return llDumpList2String(data, "&"); 42 return llDumpList2String(data, "&");
43 } 43 }
Line 44... Line 44...
44   44  
45 /////////////////////////////////////////////////////////////////////////// 45 ///////////////////////////////////////////////////////////////////////////
46 // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // 46 // Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 //
47 /////////////////////////////////////////////////////////////////////////// 47 ///////////////////////////////////////////////////////////////////////////
48 integer wasListCountExclude(list input, list exclude) { 48 integer wasListCountExclude(list input, list exclude) {
49 if(llGetListLength(input) == 0) return 0; 49 if(llGetListLength(input) == 0) return 0;
50 if(llListFindList(exclude, (list)llList2String(input, 0)) == -1) 50 if(llListFindList(exclude, (list)llList2String(input, 0)) == -1)
51 return 1 + wasListCountExclude(llDeleteSubList(input, 0, 0), exclude); 51 return 1 + wasListCountExclude(llDeleteSubList(input, 0, 0), exclude);
52 return wasListCountExclude(llDeleteSubList(input, 0, 0), exclude); 52 return wasListCountExclude(llDeleteSubList(input, 0, 0), exclude);
Line 53... Line 53...
53 } 53 }
54   54  
55 /////////////////////////////////////////////////////////////////////////// 55 ///////////////////////////////////////////////////////////////////////////
56 // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // 56 // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 //
57 /////////////////////////////////////////////////////////////////////////// 57 ///////////////////////////////////////////////////////////////////////////
58 // escapes a string in conformance with RFC1738 58 // escapes a string in conformance with RFC1738
59 string wasURLEscape(string i) { 59 string wasURLEscape(string i) {
Line 75... Line 75...
75 } while(i != ""); 75 } while(i != "");
76 return o; 76 return o;
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 // unescapes a string in conformance with RFC1738 82 // unescapes a string in conformance with RFC1738
83 string wasURLUnescape(string i) { 83 string wasURLUnescape(string i) {
84 return llUnescapeURL( 84 return llUnescapeURL(
Line 99... Line 99...
99 ) 99 )
100 ); 100 );
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 list wasCSVToList(string csv) { 106 list wasCSVToList(string csv) {
107 list l = []; 107 list l = [];
108 list s = []; 108 list s = [];