Table of Contents

Shortnote

This is a simple "raise the bar"-sploder that pays out all the money to the last person that paid in once the timer expires. The "challenge" (if any) is to be the last one to pay lindens into the sploder. The last person to pay the sploder, when the timer runs out, gets the entire pot.

The timer is initially set at 10 seconds and incremented by a random number in the range $[1..5)$ every time an avatar pays in.

Note

Oh no, not this shit again! It should be noted that any sploder can be attacked in so many ways. . . First, libomv scripted agents are able to easily read overhead texts and find out how much time is left till the countdown reaches zero. Second, if the owner is dishonest, they can easily revoke permissions for the object and they get away with the pot - although, that sort of trick only works once until the villagers come at the owner with pitchforks. Similar to the last statement, scripts are vulnerable to timing attacks - the script below uses state isolation to handle most cases but the speed of a scripted agent is sufficient to make such attacks plausible. Lastly and most obvious, if the owner is dishonest, it is easy to trim a cut from the pot by modifying the script itself. Some good advice would be to not play these things in the first place unless you are ready to lose money. Given a virtual world where no measures are in place to protect you, just the law of the jungle applies. . .

Code

sploder.lsl
///////////////////////////////////////////////////////////////////////////
//  Copyright (C) Wizardry and Steamworks 2012 - License: GNU GPLv3      //
//  Please see: http://www.gnu.org/licenses/gpl.html for legal details,  //
//  rights of fair usage, the disclaimer and warranty conditions.        //
///////////////////////////////////////////////////////////////////////////
 
string wasPrettyNumbers(integer num, list modNine) {
    list d = llParseString2List((string)num, [], ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]);
    if(llGetListLength(d) == 0) return llList2String(modNine, 0);
    string r = "";
    do {
        r += llList2String(modNine, llList2Integer(d, 0));
        d = llDeleteSubList(d, 0, 0);
    } while(llGetListLength(d) != 0);
    return r;
}
 
integer holdingLs = 0;
integer time = 10;
key lastRaise = NULL_KEY;
 
default
{
    state_entry() {
        llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
    }
 
    run_time_permissions(integer perm) {
        if(perm & PERMISSION_DEBIT) {
            holdingLs = 0;
            time = 10;
            lastRaise = NULL_KEY;
            state sploder;
        }
    }
    on_rez(integer param) {
        llResetScript();
    }
}
 
state sploder {
    state_entry() {
        llSetPayPrice(10, [10, 50, 100, 150]);
        llSetClickAction(CLICK_ACTION_PAY);
        llSetText("♧ SPLODER! ♧\nPay in any amount to start countdown!\nLast person to pay in gets the pot!\n", <0,1,0>, 1);
    }
    money(key id, integer amount) {
        time += 1+(integer)llFrand(5);
        lastRaise = id;
        holdingLs += amount;
        llSetTimerEvent(1);
    }
    timer() {
        llSetText("HOLDING: L$" + (string)holdingLs + "\nCountdown: " + wasPrettyNumbers(time, [ "⓪", "⓵", "⓶", "⓷", "⓸", "⓹", "⓺", "⓻", "⓼", "⓽" ]), <0,1,0>, 1);
        if(--time > 0) {
            llShout(0, "Time remaining: " + wasPrettyNumbers(time, [ "⓪", "⓵", "⓶", "⓷", "⓸", "⓹", "⓺", "⓻", "⓼", "⓽" ]));
            return;
        }
        state payout;
    }
    on_rez(integer num) {
         llResetScript();
    }
}
 
state payout {
    state_entry() {
        llSetTimerEvent(0);
        llGiveMoney(lastRaise, holdingLs);
        holdingLs = 0;
        time = 10;
        lastRaise = NULL_KEY;
        state sploder;
    }
    on_rez(integer num) {
         llResetScript();
    }
}

secondlife/sploder.txt · Last modified: 2022/11/24 07:46 by 127.0.0.1

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.