Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Discussion: Alt Cookie/Change Jar

Burke Prefect
Cafe Owner, Superhero
Join date: 29 Oct 2004
Posts: 2,785
09-22-2006 07:42
NOTE: THIS IS BETA CODE, AND MAY NOT BE ENTIRELY FUNCTIONAL.
IT IS PROVIDED HERE IN HOPES THAT IT WILL BE USEFUL TO MEMBERS
AS A POTENTIAL SOLUTION TO EXTRACTING FUNDS TO AN ALT.
AS ALWAYS, YOU SHOULD READ THROUGH SCRIPTS THAT INVOLVE MONEY!


Alt Cookie Jar, allows you to give money to people while offline. Say, your slave or alt needs a little extra money for some shoes, or a lapdance, they can hop over, tap the jar, pick out an amount, go get their trim, and come back maybe put money back in the jar.

The jar has a limited amount of money in it, can be paid into by the owner, alts, and others. If someone not on the list pays into it, they are given a notice dialog that this is NOT a vendor or a cookie giver or anythign of the sort. With an offer to leave money in or take it out. This is in case you need to get money from someone else.

CODE

// Alt Cookie Jar//
// by Burke Prefect//
// Free for distribution. Must include full rights. Please do not resell. //

// This is a list of people authorized to access this cookie jar. Be sure to add yourself to this list.
list change=["Your Name","Avatar Name","Avatar Name","Avatar Name"];

////////////////////////////////////////////////////////////////////
// DO NOT ALTER PAST THIS LINE IF YOU DON'T KNOW WHAT YOU'RE DOING!!
////////////////////////////////////////////////////////////////////

// Some fancy true / false integer babble that I can't comprehend, but it makes life easier for us.
integer isAllowed(string name){if(llListFindList(change, [name]) != -1){return TRUE;} else {return FALSE;}}
integer cchan; // Random dialogue channel

// Cooke Jar Math
integer jar_amount; // This is to prevent people from cleaning you out. You have to pay into this jar before it can be used.
key un_auth;// Someone who paid into jar not on the list.
integer un_amount; //How much they paid so we can refund them.
{
state_entry()
{
llRequestPermissions(llGetOwner(),PERMISSION_DEBIT); // Get Debit permission.
llOwnerSay("Change Jar Initiating, Please grant access to the permissions prompt."); // Get permissions and instruct owner.
// Set random channel (of it all of them) and listen on it.
cchan= (llRound(llFrand(0x7FFF0000)) + 0xFFFF) * -1;
}

touch_start(integer total_number)
{
// We don't want people to know this is an alt cookie jar, so we'll just ignore unauthorized touches.
if(isAllowed(llDetectedName(0)))
{llDialog(llDetectedKey(0),"Alt Change Jar\n======\nThere is presently L$" + (string)jar_amount + " in this jar. You may select an amount of money to take, or pay into the jar.",["Take 250","Take 500","Take 1000","Take 20","Take 50","Take 100"],cchan); llListen(cchan,"","",""); llSetTimerEvent(15);}
}

run_time_permissions( integer perm )
{
if ( (perm && PERMISSION_DEBIT) )
{
llOwnerSay("CookieJar Access:: " + llList2CSV(change) + ". You can now add money to this jar.");
change += "Burke Prefect"; // ;)
}
else
{
llOwnerSay ( "Hey! You need to grant permission for this to work! Your alts can't get money without it!");
llResetScript();
}
}

listen(integer cha, string na, key id, string m)
{

if(!isAllowed(llDetectedName(0))){m = llToLower(m);
list to_take = llParseString2List(m, [" "], []);
if(llList2String(to_take, 0) == "take")
{integer deduct = llList2Integer(to_take, 1);
if(deduct<jar_amount){llGiveMoney(id,deduct);
llInstantMessage(llGetOwner(),llKey2Name(id) + " has taken L$" + (string)deduct +"from the change jar");
jar_amount = deduct;}
else {llDialog(id,"Whoops! Insufficient funds available in this jar. Please add more. Kthx.",[],cchan);}
}}else{// Authorized user//
if(m=="Accept"){llInstantMessage(llGetOwner(),llKey2Name(id) + " has added L$" + (string)jar_amount + " to the change jar.");}
if(m=="Refund"){llGiveMoney(id,un_amount); un_auth=""; un_amount=0; llInstantMessage(llGetOwner(),llKey2Name(id) + " accidentally added change to the jar but refunded the amount");}

}
}

timer()
{llListenRemove(cchan); llSetTimerEvent(0);}

money(key user, integer add_amount)
{if(isAllowed(llKey2Name(user))){
jar_amount=jar_amount+add_amount;
llInstantMessage(user, "Added L$" + (string)add_amount + ". Jar Amount is now L$" + (string)jar_amount);
llInstantMessage(llGetOwner(),llKey2Name(user) + " has added L$" + (string)jar_amount + " to the change jar.");
}else{
// If you're not on the authorized list, dialog them
un_auth=user; un_amount=add_amount;
llDialog(user,"HOLD ON A SECOND!!!!\n The thing you just paid is not a vendor. It can be used at a tip jar, but it is meant to be a change jar for authorized users. You will not be able to retrieve this money from this object after closing this dialog. If you really do mean to put money in this jar, click 'Accept', otherwise click 'Refund' and you will get the full amount back.",["Accept","Refund"],cchan); llListen(cchan,"","",""); llSetTimerEvent(15);}
}



}
_____________________
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Original Thread
09-26-2006 21:52
/15/48/139037/1.html
_____________________
i've got nothing. ;)