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 // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // 3 // Please see: https://creativecommons.org/licenses/by/2.0 for legal details, //
4 // rights of fair usage, the disclaimer and warranty conditions. // 4 // rights of fair usage, the disclaimer and warranty conditions. //
5 /////////////////////////////////////////////////////////////////////////// 5 ///////////////////////////////////////////////////////////////////////////
Line 6... Line 6...
6   6  
7 /////////////////////////////////////////////////////////////////////////// 7 ///////////////////////////////////////////////////////////////////////////
8 // Copyright (C) 2011 Wizardry and Steamworks - License: GNU GPLv3 // 8 // Copyright (C) 2011 Wizardry and Steamworks - License: CC BY 2.0 //
9 /////////////////////////////////////////////////////////////////////////// 9 ///////////////////////////////////////////////////////////////////////////
10 list wasListReverse(list lst) { 10 list wasListReverse(list lst) {
11 if(llGetListLength(lst)<=1) return lst; 11 if(llGetListLength(lst)<=1) return lst;
12 return wasListReverse( 12 return wasListReverse(
13 llList2List(lst, 1, llGetListLength(lst)) 13 llList2List(lst, 1, llGetListLength(lst))
14 ) + llList2List(lst,0,0); 14 ) + llList2List(lst,0,0);
Line 15... Line 15...
15 } 15 }
16   16  
17 /////////////////////////////////////////////////////////////////////////// 17 ///////////////////////////////////////////////////////////////////////////
18 // Copyright (C) 2014 Wizardry and Steamworks - License: GNU GPLv3 // 18 // Copyright (C) 2014 Wizardry and Steamworks - License: CC BY 2.0 //
19 /////////////////////////////////////////////////////////////////////////// 19 ///////////////////////////////////////////////////////////////////////////
20 string wasDayOfWeek(integer year, integer month, integer day) { 20 string wasDayOfWeek(integer year, integer month, integer day) {
21 return llList2String( 21 return llList2String(
Line 32... Line 32...
32 ) % 7 32 ) % 7
33 ); 33 );
34 } 34 }
Line 35... Line 35...
35   35  
36 /////////////////////////////////////////////////////////////////////////// 36 ///////////////////////////////////////////////////////////////////////////
37 // Copyright (C) 2014 Wizardry and Steamworks - License: GNU GPLv3 // 37 // Copyright (C) 2014 Wizardry and Steamworks - License: CC BY 2.0 //
38 /////////////////////////////////////////////////////////////////////////// 38 ///////////////////////////////////////////////////////////////////////////
39 integer wasGetYearDays(integer year) { 39 integer wasGetYearDays(integer year) {
40 integer leap = (year % 4 == 0 && year % 100 != 0) || 40 integer leap = (year % 4 == 0 && year % 100 != 0) ||
41 (year % 400 == 0); 41 (year % 400 == 0);
Line 44... Line 44...
44 } 44 }
45 return 365; 45 return 365;
46 } 46 }
Line 47... Line 47...
47   47  
48 /////////////////////////////////////////////////////////////////////////// 48 ///////////////////////////////////////////////////////////////////////////
49 // Copyright (C) 2014 Wizardry and Steamworks - License: GNU GPLv3 // 49 // Copyright (C) 2014 Wizardry and Steamworks - License: CC BY 2.0 //
50 /////////////////////////////////////////////////////////////////////////// 50 ///////////////////////////////////////////////////////////////////////////
51 integer wasGetMonthDays(integer month, integer year) { 51 integer wasGetMonthDays(integer month, integer year) {
52 if (month == 4 || month == 6 || month == 9 || month == 11) { 52 if (month == 4 || month == 6 || month == 9 || month == 11) {
53 return 30; 53 return 30;
Line 62... Line 62...
62 } 62 }
63 return 31; 63 return 31;
64 } 64 }
Line 65... Line 65...
65   65  
66 /////////////////////////////////////////////////////////////////////////// 66 ///////////////////////////////////////////////////////////////////////////
67 // Copyright (C) 2014 Wizardry and Steamworks - License: GNU GPLv3 // 67 // Copyright (C) 2014 Wizardry and Steamworks - License: CC BY 2.0 //
68 /////////////////////////////////////////////////////////////////////////// 68 ///////////////////////////////////////////////////////////////////////////
69 string wasUnixTimeToStamp(integer unix) { 69 string wasUnixTimeToStamp(integer unix) {
70 integer year = 1970; 70 integer year = 1970;
71 integer dayno = unix / 86400; 71 integer dayno = unix / 86400;
Line 85... Line 85...
85 (string)(((unix % 86400) % 3600) / 60) + ":" + 85 (string)(((unix % 86400) % 3600) / 60) + ":" +
86 (string)(unix % 60) + ".0Z"; 86 (string)(unix % 60) + ".0Z";
87 } 87 }
Line 88... Line 88...
88 88
89 /////////////////////////////////////////////////////////////////////////// 89 ///////////////////////////////////////////////////////////////////////////
90 // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // 90 // Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 //
91 /////////////////////////////////////////////////////////////////////////// 91 ///////////////////////////////////////////////////////////////////////////
92 integer wasMenuIndex = 0; 92 integer wasMenuIndex = 0;
93 list wasDialogMenu(list input, list actions, string direction) { 93 list wasDialogMenu(list input, list actions, string direction) {
94 integer cut = 11-wasListCountExclude(actions, [""]); 94 integer cut = 11-wasListCountExclude(actions, [""]);
Line 106... Line 106...
106 input = wasListMerge(input, actions, ""); 106 input = wasListMerge(input, actions, "");
107 return input; 107 return input;
108 } 108 }
Line 109... Line 109...
109 109
110 /////////////////////////////////////////////////////////////////////////// 110 ///////////////////////////////////////////////////////////////////////////
111 // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // 111 // Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 //
112 /////////////////////////////////////////////////////////////////////////// 112 ///////////////////////////////////////////////////////////////////////////
113 integer wasListCountExclude(list input, list exclude) { 113 integer wasListCountExclude(list input, list exclude) {
114 if(llGetListLength(input) == 0) return 0; 114 if(llGetListLength(input) == 0) return 0;
115 if(llListFindList(exclude, (list)llList2String(input, 0)) == -1) 115 if(llListFindList(exclude, (list)llList2String(input, 0)) == -1)
116 return 1 + wasListCountExclude(llDeleteSubList(input, 0, 0), exclude); 116 return 1 + wasListCountExclude(llDeleteSubList(input, 0, 0), exclude);
117 return wasListCountExclude(llDeleteSubList(input, 0, 0), exclude); 117 return wasListCountExclude(llDeleteSubList(input, 0, 0), exclude);
Line 118... Line 118...
118 } 118 }
119 119
120 /////////////////////////////////////////////////////////////////////////// 120 ///////////////////////////////////////////////////////////////////////////
121 // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // 121 // Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 //
122 /////////////////////////////////////////////////////////////////////////// 122 ///////////////////////////////////////////////////////////////////////////
123 list wasListMerge(list l, list m, string merge) { 123 list wasListMerge(list l, list m, string merge) {
124 if(llGetListLength(l) == 0 && llGetListLength(m) == 0) return []; 124 if(llGetListLength(l) == 0 && llGetListLength(m) == 0) return [];