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 an automatic teleporter, and patrol script for the Corrade 5 // This is an automatic teleporter, and patrol script for the Corrade
6 // Second Life / OpenSim bot. You can find more details about the bot 6 // Second Life / OpenSim bot. You can find more details about the bot
7 // by following the URL: http://was.fm/secondlife/scripted_agents/corrade 7 // by following the URL: http://was.fm/secondlife/scripted_agents/corrade
8 // 8 //
9 // The purpose of this script is to demonstrate patroling with Corrade and 9 // The purpose of this script is to demonstrate patroling with Corrade and
10 // you are free to use, change, and commercialize it under the GNU/GPLv3 10 // you are free to use, change, and commercialize it under the CC BY 2.0
11 // license which can be found at: http://www.gnu.org/licenses/gpl.html 11 // license which can be found at: https://creativecommons.org/licenses/by/2.0
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 // unescapes a string in conformance with RFC1738 120 // unescapes a string in conformance with RFC1738
121 string wasURLUnescape(string i) { 121 string wasURLUnescape(string i) {
122 return llUnescapeURL( 122 return llUnescapeURL(