Thursday, November 20, 2008
USERLOGIN PASSWORD Remember?
You are here » Learning Center ยป Forums

Openlife Forums

 Openlife Grid Forums
Minimize
 
  Openlife Forums  Scripting  Openlife LSL Ex...  Tipjar Script
Previous Previous
 
Next Next
New Post 9/1/2008 12:44 AM
User is offline Soundwave
9 posts
Openlife Newbie


Tipjar Script 

Hello,I imported a tipjar script from SL.

The basic script works in OL exept that the money system isn`t working yet.

Feel free to use it in advance for when the money system will work in the near future.

Here is the script.

==========================================================

//   This is not my own script but i imported it in OL for testing
//   It works sofar exept that the money system doesn`t work yet in OL
//   But feel free to use it in advance for when the money system will work
//   Tip Jar Script Implementation
//
//   Copyright (C) Allister Beerbaum - Brad Henry <j0j0@riod.ca> 2007
//
//   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 3 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, see <http://www.gnu.org/licenses/>.

 

// global constants
string CUSTOM_TEXT = "Please Donate\nThank You";

list DEFAULT_QUICK_PAY_AMOUNTS = [5, 10, 20, 50];

integer DEFAULT_PRICE = PAY_DEFAULT;

string DEFAULT_DONOR = "<nobody>";

float PARTICLE_EFFECT_TIMER = 6.0;

vector PARTICLE_EFFECT_COLOUR = <1.0, 0.0, 0.0>;

vector FLOATING_TEXT_COLOUR = <1.0, 1.0, 1.0>;

// global variables

integer last_donation = 0;
integer total_donations = 0;

key last_donor = NULL_KEY;

write_floating_text()
{
    string donor = DEFAULT_DONOR;
   
    if (last_donor != NULL_KEY)
    {
        donor = llKey2Name(last_donor);
    }
    llSetText(CUSTOM_TEXT +
                "\n" +
                "Last donation: L$" +
                (string)last_donation +
                " by " + donor + ".\n" +
                "Total donations: L$" +
                (string)total_donations + ".\n",
            FLOATING_TEXT_COLOUR,
            1.0);
}

enable_particle_effect()
{
            llParticleSystem(
          [PSYS_PART_FLAGS,             PSYS_PART_EMISSIVE_MASK,
           PSYS_SRC_PATTERN,            PSYS_SRC_PATTERN_ANGLE,
           PSYS_PART_START_COLOR,       PARTICLE_EFFECT_COLOUR,
           PSYS_SRC_ANGLE_BEGIN,        (DEG_TO_RAD * -90),
           PSYS_SRC_ANGLE_END,          (DEG_TO_RAD * 90),
           PSYS_SRC_BURST_RATE,         0.0,
           PSYS_SRC_BURST_PART_COUNT,   5,
           PSYS_PART_MAX_AGE,           4.0
          ] );
}

disable_particle_effect()
{
    llParticleSystem([]);
}

default
{
    on_rez(integer start_param)
    {
        llResetScript();
    }

    state_entry()
    {
        llOwnerSay("Tip Jar at " + (string)llGetPos() + " is initializing.");
        llSetPayPrice(DEFAULT_PRICE, DEFAULT_QUICK_PAY_AMOUNTS);
        write_floating_text();
       
    }

    money(key id, integer amount)
    {
        last_donor = id;
        last_donation = amount;
        total_donations += amount;
        llSay(PUBLIC_CHANNEL, "Thank you for the donation, " + llKey2Name(last_donor) + "!");
        llOwnerSay("Tip Jar at " +
                    (string)llGetPos() +
                    " was paid " +
                    (string)last_donation +
                    " by " +
                    llKey2Name(last_donor) + ".");
        write_floating_text();
       
        enable_particle_effect();
        llSetTimerEvent(PARTICLE_EFFECT_TIMER);
    }

    timer()
    {
        disable_particle_effect();
        llSetTimerEvent(0.0);
    }
}

========================================================

Greetings Tascha Roffo.


May U Live 2 C The Dawn
 
Previous Previous
 
Next Next
  Openlife Forums  Scripting  Openlife LSL Ex...  Tipjar Script
 Popular Forum Threads
Minimize
In the past 1 week, we have 70 new thread(s) and 275 new post(s)
The most popular thread has been GLBT Region?
The most active thread has been GLBT Region?
Privacy Statement | Terms Of UseAll Rights Reserved 2007,2008 3DX - Openlifegrid.com