Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Chat SL_Chat_Tax  

SL_Chat_Tax

Originally deployed on New York Law School's Democracy Island, this tool may assist creating a more reflective classroom experience. Students pay money into the object and then are "taxed" a Linden for each character they type. This sounds counterintuitive, right? Of course you want students to speak up and contribute. But when used in combination with some other incentive to contribute in a meaningful' way, this script may keep the chatter down and the students focused on the subject. The term "signal to noise ratio" has some relevance here! On the other hand, this may be stultifying and Orwellian. Your call.

Category: Chat
By : Max Case
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for SL_Chat_Tax
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. SL_Chat_Tax_1.lsl
1 //=============================================================
2
3 //SL CHAT TAX, 0.3
4
5 //Calculates chat participation by the character and
6 // TODO: debits funds on account for each participant
7
8 //Copyright (C) 2006 Max Case
9
10 //=============================================================
11
12
13
14 //LICENSE ===============
15
16 //This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. See: http://www.gnu.org/licenses/licenses.html
17
18 //SETTING UP THE OBJECT ===============
19 //Currently people can pay off their debt.
20 // Host can insist they pay into the pot.
21 //
22 // Some variables to play with at the top. Most are self explanitory - wordcost, charcost
23 // Nice thing is, it deals with fractions of lindens.
24 //TODO - Have host do refund of left over money at end of event.
25 //Let me know what other factors you would find useful. Maybe Time of event as multiplier?
26 //
27
28
29 float wordcost = .02; //Cost per word
30 float charcost = .001; //Cost per character- someone use longer words?
31
32 float gf_running_total; //Tracks running total of all outstanding.
33
34 //This list holds money owned, name of debtor.
35 list lg_owed_name = []; //0 = total owed , +1 = Name
36
37 // fn_check_list
38 // Checks if name on list, if no, return -1, else returns index #
39 integer fn_check_list( list to_check, string name)
40 {
41 // dump the name into a temp list, since we will use list functions on this info
42 list new_name_temp = [name];
43 integer indexReturn = llListFindList(to_check, new_name_temp);
44 return indexReturn;
45 }
46
47 //Adds a name to a list :), in this case, our master list.
48 //just a utility function
49 fn_add_to_list( string name )
50 {
51 // dump the name into a temp list, since we will use this to add to the list.
52 list new_name_temp = [0.0, name];
53
54 //add name to list.
55 lg_owed_name += new_name_temp ;
56 }
57
58
59 //this calculates charge
60 //TODO - Ability to charge more for words on 'hit list'
61 fn_calc_charge(string name,key id, string msg)
62 {
63 list number = llParseString2List(msg, [" "], []);
64
65 float owed = ((float)llGetListLength(number) ) * wordcost + ( (float)llStringLength(msg) * charcost) ;
66
67 integer checkList = fn_check_list( lg_owed_name, name ) ;
68
69 //Check if they have already spoken
70 if( checkList == -1 )
71 { //never voted before?
72 fn_add_to_list( name);
73 checkList = fn_check_list( lg_owed_name, name ) ;
74 }
75
76 fn_process_speech(checkList,owed, id );
77
78 }
79
80 //Here's where update charges on list
81 fn_process_speech(integer speaker_id, float charge, key id)
82 {
83 integer speakerIndex = speaker_id; //where the name is.
84 integer owedIndex = speakerIndex - 1; //where the votes are in list
85
86 float current_owed = llList2Float(lg_owed_name, owedIndex ) ;
87
88 list tempadd = [ charge + current_owed ] ;
89 lg_owed_name = llListReplaceList(lg_owed_name, tempadd, owedIndex, owedIndex);
90 }
91
92 //Says the current charges. Used in Touch event below
93 //mode sets it to SETTEXT mode(1) or SAY mode(0) or ownersay 2
94 fn_report(integer mode)
95 {
96 integer i;
97 integer looplength = ( (llGetListLength(lg_owed_name) )/2 );
98
99 llSay(0, "Speech Taxation System BETA Update");
100
101 string reportmessage;
102
103 list tempsort = llListSort(lg_owed_name, 2, FALSE);
104 for (i = 0; i < looplength; i++)
105 {
106 string towed = llList2String(tempsort, i*2);
107 if(mode == 1) reportmessage = "";
108 reportmessage = reportmessage + llDeleteSubString(towed , llSubStringIndex(towed,".")+3, -1)+ "$L :";
109 reportmessage = reportmessage + llList2String(tempsort, ((i*2)+1));
110 if(mode == 0)
111 {
112 llSay(0, reportmessage);
113 }
114 else if(mode == 2)
115 {
116 llOwnerSay(reportmessage);
117 }
118 else if(mode == 1)
119 {
120 reportmessage += "\n" ;
121 }
122
123 }
124
125 if(mode == 1)
126 {
127 llSetText( reportmessage, <1,1,1>, 1.0);
128 }
129 }
130
131 default
132 {
134 {
135 //Turn on the listen...
136 llListen(0, "", NULL_KEY,"");
137
138 llSay(0, llGetObjectName()+" Online");
139 llSetText(llGetObjectName()+" Online", <1,1,1>, .5);
140 }
141
142 listen(integer channel, string name, key id, string msg)
143 {
144 //Check if it's Object talking
145 if( llGetAgentSize(id) == ZERO_VECTOR ) return;
146
147 //This calculated cost, then processes (updates) the list...
148 fn_calc_charge(name, id, msg);
149 fn_report(1);
150 }
151
152 //Someone wants to pay their debt...
153 money(key id, integer amount)
154 {
155 //We flip the amount, so it gives person credit
156 float owed = (float)(-amount) ;
157
158 integer checkList = fn_check_list( lg_owed_name, llKey2Name(id)) ;
159
160 //Check if they have already spoken
161 if( checkList == -1 )
162 { //never voted before?
163 fn_add_to_list( llKey2Name(id));
164 checkList = fn_check_list( lg_owed_name, llKey2Name(id)) ;
165 }
166
167 fn_process_speech(checkList, owed, id );
168
169 llSay(0, llKey2Name(id) + " pays their debt to society.");
170
171 fn_report(1);
172 }
173
174 on_rez(integer foo)
175 {
176 // llResetScript();
177 }
178
179 touch_start(integer total_number)
180 { //you can wear as HUD - this checks - if HUD, won't other telling to pay into it.
181 if( llGetAttached() < 31)
182 {
183 llSay(0, "Pay Into Machine To Pay Speech Tax. Speech Ain't Free You Know.");
184 }
185 fn_report(2);
186 }
187 }

Back to the Best Free Tools in Second Life and OpenSim.