Bugün Second Life tek yerde Hediyeler ve freebie’ler her saat güncellenir 7 dil Ücretsiz mağazanı ekle
12:49 SLT Etkinliğini ekle+ Ekle
Grid sorunu
  • Planlı: Scheduled Billing Maintenance, 16 Kas Pzt 09:30–10:30 SLT
  • Grid durumu: Unscheduled Group Chat Maintenance (investigating)
  • Şimdi: UUtopia'da Unitarian Universalist Cumartesi Ayini
  • Şimdi: The Dharma of Community: Budist Toplum ve Householder
  • Şimdi: SLCS Harvest Fest: oyunlar, müzik ve eğlence
  • 14:00 SLT: Cascadia Moondance'te NAD GOUGH canlı performans, 14:00 SLT
  • Haberler: REZZ MALL: Second Life markaları tek bir web mağazasında
  • Viewer: Second Life Viewer 26.5 ile sohbet yenileniyor
  • Planlı: Scheduled Billing Maintenance, 16 Kas Pzt 09:30–10:30 SLT
  • Grid durumu: Unscheduled Group Chat Maintenance (investigating)
  • Şimdi: UUtopia'da Unitarian Universalist Cumartesi Ayini
  • Şimdi: The Dharma of Community: Budist Toplum ve Householder
  • Şimdi: SLCS Harvest Fest: oyunlar, müzik ve eğlence
  • 14:00 SLT: Cascadia Moondance'te NAD GOUGH canlı performans, 14:00 SLT
  • Haberler: REZZ MALL: Second Life markaları tek bir web mağazasında
  • Viewer: Second Life Viewer 26.5 ile sohbet yenileniyor
LSL script

LSL tip jar script with thank-you message and total

Free LSL tip jar script for Second Life clubs, DJs, hosts and stores: quick pay buttons, a thank-you message, the total and last tipper in floating text.

96 satır ·

A tip jar is part of every club, live music venue and event in Second Life. This free script turns any object into one: residents pay it, it thanks them by name, and it shows the total and the last tipper above the jar.

lsl-tip-jar-script.lsl · 96 satır Bu scripti denetle
// Tip Jar - free LSL script from WhatSL (https://whatsl.com/scripts/lsl-tip-jar-script)
// Free to use, change and put in your own creations, also ones you sell.
//
// Put this script in any object. Residents pay the object, it thanks them and shows the total.
// The money goes to the owner of the object (or to the group, if the object is deeded to a group).
// Owner: touch the jar (right-click > Touch when CLICK_TO_PAY is on) to see the total or reset it.

string  THANK_YOU      = "Thank you for the tip, %name%!";  // %name% becomes the tipper's name
integer PUBLIC_THANKS  = TRUE;     // TRUE = say thanks in local chat, FALSE = only the tipper sees it
integer DEFAULT_AMOUNT = 100;      // the amount in the Pay window's box
list    QUICK_AMOUNTS  = [50, 100, 250, 500];  // exactly four quick buttons, in L$
integer CLICK_TO_PAY   = TRUE;     // TRUE = a left click opens the Pay window
vector  TEXT_COLOR     = <1.0, 0.85, 0.3>;

integer gTotal = 0;
string  gLast = "";
string  gOwnerName = "";
integer gChan;
integer gListen;

string fillName(string s, string name)
{
    integer i = llSubStringIndex(s, "%name%");
    if (i == -1) return s;
    return llInsertString(llDeleteSubString(s, i, i + 5), i, name);
}

showText()
{
    string t = "Tip jar";
    if (gOwnerName != "") t += " for " + gOwnerName;
    t += "\nL$" + (string)gTotal + " received";
    if (gLast != "") t += "\nLast tip: " + gLast;
    llSetText(t, TEXT_COLOR, 1.0);
}

default
{
    state_entry()
    {
        gOwnerName = llGetDisplayName(llGetOwner());
        llSetPayPrice(DEFAULT_AMOUNT, QUICK_AMOUNTS);
        if (CLICK_TO_PAY) llSetClickAction(CLICK_ACTION_PAY);
        else llSetClickAction(CLICK_ACTION_TOUCH);
        showText();
    }

    on_rez(integer param)
    {
        llResetScript();
    }

    money(key id, integer amount)
    {
        gTotal += amount;
        gLast = llGetDisplayName(id);
        string msg = fillName(THANK_YOU, gLast);
        if (PUBLIC_THANKS) llSay(0, msg);
        else llRegionSayTo(id, 0, msg);
        showText();
    }

    touch_start(integer total)
    {
        key who = llDetectedKey(0);
        if (who != llGetOwner())
        {
            llRegionSayTo(who, 0, "Right-click me and choose Pay to leave a tip. Thank you!");
            return;
        }
        llListenRemove(gListen);
        gChan = -1000000 - (integer)llFrand(1000000.0);
        gListen = llListen(gChan, "", who, "");
        llDialog(who, "Tip jar total: L$" + (string)gTotal, ["Reset total", "Close"], gChan);
        llSetTimerEvent(60.0);
    }

    listen(integer channel, string name, key id, string message)
    {
        if (message == "Reset total")
        {
            gTotal = 0;
            gLast = "";
            showText();
            llOwnerSay("The total is back to L$0.");
        }
        llListenRemove(gListen);
        llSetTimerEvent(0.0);
    }

    timer()
    {
        llListenRemove(gListen);
        llSetTimerEvent(0.0);
    }
}

Ücretsizdir: kullanabilir, değiştirebilir ve sattıkların dahil kendi yapımlarına koyabilirsin.

How to set it up

  1. Make or rez the jar and put the script in its Contents.
  2. Change the thank-you message and the four quick amounts if you like, then save.
  3. Left-click the jar: the Pay window opens. Pay yourself L$1 to test it.
  4. As the owner, right-click the jar and choose Touch to see the total or reset it.

Settings

  • THANK_YOU: the message after each tip. %name% becomes the tipper's display name.
  • PUBLIC_THANKS: TRUE thanks people in local chat, FALSE sends it only to the tipper.
  • DEFAULT_AMOUNT and QUICK_AMOUNTS: the amount in the Pay box and the four quick buttons, in L$.
  • CLICK_TO_PAY: TRUE opens the Pay window with a normal left click.
  • TEXT_COLOR: the colour of the floating text.

Who gets the money?

Tips go to the owner of the object. If you deed the object to a group, the money goes to the group instead. For a DJ and a host sharing tips, each can rez their own jar, or the venue can deed a jar to the club group.

Frequently asked questions

Does the tip jar need debit permission?

No. Receiving money does not need any permission. Never give a tip jar permission to take money from your account.

Why does the total go back to zero?

The total is kept while the script runs. Taking the jar into inventory and rezzing it again resets it, as does resetting the script.

Can I hide the floating text?

Yes. Remove the showText() calls, or set the text colour's transparency in llSetText to 0.0.

Kendi scriptini denetle: LSL sözdizimi denetleyicisi →

Diğer scriptlerTüm scriptler
LSL script · 55 satır

LSL kapı scripti: dokununca açılır, kendi kendine kapanır

Second Life için ücretsiz LSL kapı scripti. Dokununca açılıp kapanır, kapı menteşesi üzerinde döner ve birkaç saniye sonra kendiliğinden kapanır. Sesler isteğe bağlı.

LSL script · 69 satır

LSL sit and pose script for chairs and pose balls

Free LSL sit script for Second Life chairs, benches and pose balls: sit and play your own animation, set the sit position, hide the ball while in use.

LSL script · 101 satır

LSL hediye dağıtma scripti: freebie ve grup hediyeleri için

Second Life mağazaları için ücretsiz LSL hediye scripti: dokunun, tüm eşyalar tek klasörde gelsin. Herkes ya da yalnızca grup etiketini takanlar için.