/////////////////////////////////////////////////////////////////////////// // 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(); } }