きょうの Second Life をひとつの場所で ギフトとフリービー を毎時間更新 7言語 無料 でお店を掲載
グリッド障害
  • 予定: Scheduled Billing Maintenance, 11月16日(月) 09:30–10:30 SLT
  • グリッド状況: Unscheduled Group Chat Maintenance (investigating)
  • 開催中: UUtopiaのUnitarian Universalist土曜礼拝
  • 開催中: The Dharma of Community: 仏教社会と在家の生き方
  • 開催中: SLCSハーベストフェスト:ゲーム、音楽、お楽しみ
  • 14:00 SLT: Cascadiaのムーンダンスで NAD GOUGH ライブ 14:00 SLT
  • ニュース: REZZ MALL: Second Lifeのブランドが集まるウェブモール
  • Viewer: Second Life Viewer 26.5 チャットを刷新
  • 予定: Scheduled Billing Maintenance, 11月16日(月) 09:30–10:30 SLT
  • グリッド状況: Unscheduled Group Chat Maintenance (investigating)
  • 開催中: UUtopiaのUnitarian Universalist土曜礼拝
  • 開催中: The Dharma of Community: 仏教社会と在家の生き方
  • 開催中: SLCSハーベストフェスト:ゲーム、音楽、お楽しみ
  • 14:00 SLT: Cascadiaのムーンダンスで NAD GOUGH ライブ 14:00 SLT
  • ニュース: REZZ MALL: Second Lifeのブランドが集まるウェブモール
  • Viewer: Second Life Viewer 26.5 チャットを刷新
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行 ·

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行 このスクリプトをチェック
// 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);
    }
}

自由に使用・改変でき、販売する作品にも組み込めます。

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.

自分のスクリプトをチェック: LSL構文チェッカー →

ほかのスクリプトすべてのスクリプト
LSLスクリプト · 55行

LSLのドアスクリプト:タッチで開閉し、自動で閉まる

Second Life用の無料LSLドアスクリプトです。ドアをタッチすると蝶番を軸に開き、もう一度タッチするか数秒後に自動で閉まります。閉じた位置を覚えるので、後からドアを動かしても問題なく動作し、効果音も設定できます。

LSLスクリプト · 69行

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スクリプト · 101行

Freebie・グループギフト用LSLギフトスクリプト

SLストア向けの無料LSLギフトスクリプト。タッチするとすべてのアイテムを1つのフォルダでお渡し。全員向けにも、グループタグを付けた人だけ向けにも設定可能。