Second Life hoy en un solo lugar Regalos y freebies actualizados cada hora 7 idiomas Gratis publicar tu tienda
12:49 SLT Publica tu evento+ Publicar
Problema en el grid
  • Programado: Scheduled Billing Maintenance, lun, 16 nov 09:30–10:30 SLT
  • Estado del grid: Unscheduled Group Chat Maintenance (investigating)
  • Ahora: Servicio sabático Unitarian Universalist en UUtopia
  • Ahora: The Dharma of Community: Sociedad budista y el householder
  • Ahora: Harvest Fest de SLCS: juegos, música y diversión
  • 14:00 SLT: NAD GOUGH en vivo en Moondance en Cascadia, 14:00 SLT
  • Noticias: REZZ MALL: marcas de Second Life en un centro comercial web
  • Viewer: Second Life Viewer 26.5 moderniza el chat
  • Programado: Scheduled Billing Maintenance, lun, 16 nov 09:30–10:30 SLT
  • Estado del grid: Unscheduled Group Chat Maintenance (investigating)
  • Ahora: Servicio sabático Unitarian Universalist en UUtopia
  • Ahora: The Dharma of Community: Sociedad budista y el householder
  • Ahora: Harvest Fest de SLCS: juegos, música y diversión
  • 14:00 SLT: NAD GOUGH en vivo en Moondance en Cascadia, 14:00 SLT
  • Noticias: REZZ MALL: marcas de Second Life en un centro comercial web
  • Viewer: Second Life Viewer 26.5 moderniza el chat
Script LSL

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 líneas ·

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 líneas Comprobar este script
// 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);
    }
}

Libre para usar, cambiar e incluir en tus creaciones, también en las que vendes.

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.

Comprueba tu propio script: Comprobador de sintaxis LSL →

Más scriptsTodos los scripts
Script LSL · 55 líneas

Script de puerta en LSL: se abre al tocar y se cierra sola

Script de puerta gratuito en LSL para Second Life. Tócala para abrirla y cerrarla; la puerta gira sobre sus bisagras y se cierra sola tras unos segundos. Sonidos opcionales.

Script LSL · 69 líneas

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.

Script LSL · 101 líneas

Script LSL para regalos gratis y regalos de grupo en Second Life

Script LSL gratis para dar regalos en tiendas de Second Life: toca y recibe todos los objetos en una carpeta, para todos o solo para miembros del grupo con la etiqueta.