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
Tip Jar Tipjar_script_with_a_goal_and_progr  

Tipjar_script_with_a_goal_and_progr

Tipjar script with a 'goal' and progress meter by Angel Fluffy.lsl

Category: Tip Jar
By : Angel Fluffy
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for Tipjar_script_with_a_goal_and_progr
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Tipjar_script_with_a_goal_and_progr_1.lsl
1
2 //********************************************************
3 //This Script was pulled out for you by YadNi Monde from the SL FORUMS at http://forums.secondlife.com/forumdisplay.php?f=15, it is intended to stay FREE by it s author(s) and all the comments here in ORANGE must NOT be deleted. They include notes on how to use it and no help will be provided either by YadNi Monde or it s Author(s). IF YOU DO NOT AGREE WITH THIS JUST DONT USE!!!
4 //********************************************************
5
6
7
8
9
10
11
12 // CARP Donation box script. Written by Angel Fluffy, with credit to :
13 // Keknehv Psaltery, jean cook, ama omega, nada epoch, YadNi Monde
14 // for their work on the "DONATION box" script upon which it was based.
15 //
16 //Donation / Tipjar script with a 'goal' and progress meter (ideal for tracking tier)
17 //What it is : a donation box / tip jar script, that uses the concept of 'goals' and a progress meter to encourage people to donate (as people donate more when they can see the progress being made towards a set goal).
18 //
19 //Edit the config settings, drop in a prim, and pay it some money to find out how it works.
20 //
21 //In future, I intend to add a 'biggest donors' field to it which people can use to recieve a list of the top 5 donors when the prim is clicked on.
22 //
23 //
24 //CODE
25 string imtext = "I'm the __________ Donation Box! Please right click and pay me to donate, as this supports the __________ project and helps keep the place open for you!";
26 // this is the text sent to someone who clicks on the prim containing this script and who isn't the owner.
27
28 // first line of hover text above box (always constant)
29 string floaty = "__________ Donation Box\n";
30
31 // when total donated this month is less than monthlyneeded, display whatfunding_1 as the funding target,
32 // when it is more, display whatfunding_2. This allows you to show your donors when you have switched
33 // from funding your essential running costs to funding expansion.
34 string whatfunding_1 = "Funding : __________ \n";
35 string whatfunding_2 = "Funding : __________ \n";
36
37 // name of the current month
38 // we *could* get this automatically, but changing the month automatically isn't as easy as it seems.
39 // This is a change I might make in a future version.
40 string thismonth = "October";
41
42 // How much are we trying to raise per month?
43 // The script displays a countdown in SETTEXT above the prim its in, counting down until this target is reached.
44 // After this target is reached, the countdown disappears, being replaced with a tally.
45 // The goal of this is to encourage people to donate by setting a clear goal they feel they can help achieve by donating.
46 integer monthlyneeded = 30000;
47
48
49 // These two variables define the starting numbers for how much has been donated across all time, and how much this month.
50 // These starting numbers will have the donations the script recieves in between each reset/save added to it,
51 // and the result displayed in float text over the top of the script.
52 // The first time you start accepting donations, you should set both of the numbers below to zero.
53 // When saving this script, you (the object owner) should touch the donation box object,
54 // which will then tell you how much has been donated in total and how much has been donated this month.
55 // Entering this information here before saving will allow you to preserve the 'state' of the script across edits/restarts.
56 integer totaldonated = 0;
57 integer monthdonated = 0;
58
59 // these settings are like the above, but save the 'last donor' information. You can set them to "" and 0 to clear saved info.
60 string lastdonor = "Taffy Tinlegs";
61 integer lastdonated = 0;
62
63 // this interval defines how long we wait between each reminder to donate broadcast to SAY (range=20m)
64 integer timer_interval = 3600;
65
66 // these settings determine what the 'default' donation amounts are.
67 // the buttons are the 'fast pay' buttons, the 'payfield' is the default amount in the text box.
68 list paybuttons = [50,200,400,800];
69 integer payfield = 100;
70
71
72 // these variables should be left undefined.
73 string owner;
74 string otext;
75 integer mpercent;
76
77 integer updatemath() {
78 float mpercentfloat = ((monthdonated * 100) / monthlyneeded);
79 mpercent = (integer)mpercentfloat;
80
81 return 1;
82 }
83
84 integer updatetext() {
85 otext = floaty;
86
87 if(mpercent >= 100) {
88 otext += whatfunding_2;
89 } else {
90 otext += whatfunding_1;
91 }
92 if(lastdonated > 0) {
93 otext += "Last donation : L$" + (string)lastdonated + " by " + lastdonor +"\n";
94 }
95 if(mpercent >= 100) {
96 otext += "We have raised L$"+(string)(monthdonated - monthlyneeded)+" for this, beyond our basic running costs of L$"+(string)monthlyneeded+" for "+thismonth+". \n";
97 //otext += "The excess will go towards giving prizes and running special events!";
98 } else {
99 otext += "Our donors have contributed "+(string)mpercent+"% of our basic running costs ("+(string)monthdonated+"/"+(string)monthlyneeded+") for "+thismonth+".\n";
100 }
101 llSetText(otext,<1,1,1>,1);
102 return 1;
103 }
104 default
105 {
106 on_rez( integer sparam )
107 {
109 }
111 {
112 updatemath();
113 updatetext();
114 owner = llKey2Name( llGetOwner() );
115 llSetPayPrice(payfield,paybuttons);
116 llSetTimerEvent(timer_interval);
117 llSay(0,"Script updated. Usually this is caused by the donation box owner updating the script.");
118 }
119
120 money(key id, integer amount)
121 {
122 totaldonated += amount;
123 monthdonated += amount;
124 lastdonor = llKey2Name(id);
125 lastdonated = amount;
126 updatemath();
127 updatetext();
128 llInstantMessage(id,"On behalf of everyone who uses this place, thank you for the donation!");
129 llSay(0,(string)llKey2Name(id)+" donated L$" + (string)amount + ". Thank you very much for supporting us, it is much appreciated!" );
130 }
131 touch_start(integer num_detected){
132 if(llDetectedKey(0) == llGetOwner()) {
133 llOwnerSay("Reporting script status, because you are recognised as the owner of this donation box.");
134 llOwnerSay("Current TOTAL donations across all time: L$"+(string)totaldonated);
135 llOwnerSay("Current TOTAL donations for this month: L$"+(string)monthdonated);
136 } else {
138 }
139 }
140 timer() {
141 integer premainder = 100 - mpercent;
142 integer aremainder = monthlyneeded - monthdonated;
143 if(mpercent < 100) {
144 llSay(0,"We still need to meet the last "+(string)premainder+"% of our basic costs (L$"+(string)aremainder+") this month, to pay for land tier etc. Please consider donating to help us out!");
145 }
146 llSetTimerEvent(timer_interval);
147 }
148 } // END //

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