|
Tiki Nightfire
Registered User
Join date: 20 Apr 2008
Posts: 1
|
12-26-2008 10:58
Hey Y'all!
I'm trying to find a script that can do two things:
1) when the prim is touched by an avatar, the prim will pay the avatar x amount of Lindens 2) can only be touched once per 24 hour period. 3) and I would think I would have to load the object with Lindens to pay out
If you know of this script, and can share it, or, point me in the right direction I would greatly appreciate it. Even knowing the the script commands I will need to do this, would be greatly helpful. I've looked in the library, but can't seem to find what i need.
I greatly appreciate it.
|
|
Imago Aeon
Animation Designer
Join date: 23 Oct 2007
Posts: 65
|
12-26-2008 11:10
key id; integer amount = 10; // amount to give default { state_entry() { llRequestPermissions(llGetOwner(), PERMISSION_DEBIT); } // // touch_start(integer total_number) { id = llDetectedKey(0); llGiveMoney(id, amount); llDie(); } on_rez(integer start_param) { llResetScript(); } } Hope it helps! This script pays out 10 L$ and then dies. So it prevents someone from retouching it indefinately. Although, you probably could put a key sensor in it to keep them from doing it. I've been looking for something like that (a key sensor) so that people couldn't take freebies all day long. Got bored and just never wrote a routine for it. But this script was floating in my inventory. (Have no idea where it came from or who made it originally.)
|
|
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
|
12-26-2008 11:31
From: Tiki Nightfire 3) and I would think I would have to load the object with Lindens to pay out
The money will be taken from the owners account, there are no other ways 
_____________________
From Studio Dora
|
|
Ee Maculate
Owner of Fourmile Castle
Join date: 11 Jan 2007
Posts: 919
|
12-26-2008 11:39
From: Dora Gustafson The money will be taken from the owners account, there are no other ways  So set up an alt to manage the money just to be safe.....
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
12-26-2008 12:36
From: Dora Gustafson The money will be taken from the owners account, there are no other ways  Except that you could certainly put a limit in the script on the amount of money it will give away. Something like this: //// Constants
integer CMD_CHANNEL = 86;
// format is: report string REPORT_CHAT = "report"; // format is: clear waits string CLEAR_WAITS_CHAT = "clear waits"; // format is: authorize <nLindensLeft> string SET_FUNDS_CHAT_PREFIX = "authorize "; // format is: give <nLindensToGive> string SET_AMOUNT_CHAT_PREFIX = "give ";
integer DEFAULT_GIVE_AMOUNT = 10; float WAIT_PERIOD = 86400.0; // 24*60*60 secs = 24 hours float CLEANUP_PERIOD = 300.0; // 5*60 sec = 5 min
//// Variables
integer startingFunds = 0; integer fundsLeft = 0; integer giveAmount = DEFAULT_GIVE_AMOUNT;
list recipients = []; list giveTimes = []; integer nRecipients = 0;
//// Functions
report() { llOwnerSay( "\n"+ "Giving L$"+(string)giveAmount+" each touch.\n"+ "L$"+(string)fundsLeft+" / L$"+(string)startingFunds+" left to give.\n"+ (string)nRecipients+ " residents on wait list."); }
reportOutOfFunds() { string sim = llEscapeURL(llGetRegionName()); vector pos = llGetPos(); integer posX = (integer)pos.x; integer posY = (integer)pos.y; integer posZ = (integer)pos.z;
string slurl = "http://slurl.com/secondlife/"+sim+"/"+ (string)posX+"/"+(string)posY+"/"+(string)posZ+"/";
llInstantMessage( llGetOwner(), "@ "+slurl+"\n"+ "All L$"+(string)startingFunds+ " given. Authorization required for further operation"); }
processTouch(key toucher) { if (llListFindList(recipients, [ toucher ]) >= 0) { llInstantMessage( toucher, "Sorry, but you have recently received L$ from this source. "+ "Try again some other time."); } else if (fundsLeft <= 0 || giveAmount <= 0) { llInstantMessage( toucher, "Sorry, but there are no more L$ to give at the moment. "+ "Try again some other time."); } else { integer amount = giveAmount; if (amount > fundsLeft) { amount = fundsLeft; }
llGiveMoney(toucher, amount); fundsLeft -= amount; addRecipient(toucher);
llInstantMessage(toucher, "Enjoy your gift!");
if (fundsLeft <= 0) { reportOutOfFunds(); } } }
addRecipient(key recipient) { if (nRecipients <= 0) { llSetTimerEvent(CLEANUP_PERIOD); }
recipients += [ recipient ]; giveTimes += [ llGetTime() ]; ++nRecipients; }
clearRecipients() { recipients = []; giveTimes = []; nRecipients = 0;
llSetTimerEvent(0.0); llResetTime(); }
cleanupRecipients() { float waitStart = llGetTime()-WAIT_PERIOD;
integer i = 0; while (i < nRecipients && llList2Float(giveTimes, i) < waitStart) { ++i; }
if (i > 0) { recipients = llDeleteSubList(recipients, 0, i-1); giveTimes = llDeleteSubList(giveTimes, 0, i-1); nRecipients -= i;
if (nRecipients <= 0) { llSetTimerEvent(0.0); llResetTime(); } } }
//// States
default { state_entry() { llRequestPermissions(llGetOwner(), PERMISSION_DEBIT); }
run_time_permissions(integer perms) { if (perms & PERMISSION_DEBIT) { state giving; } } }
state giving { state_entry() { llListen(CMD_CHANNEL, "", llGetOwner(), "");
clearRecipients(); report(); }
state_exit() { llSetTimerEvent(0.0); }
changed(integer changes) { if (changes & CHANGED_OWNER) { state default; } }
listen(integer channel, string name, key id, string message) { if (id != llGetOwner()) { return; }
if (message == REPORT_CHAT) { report(); } else if (message == CLEAR_WAITS_CHAT) { clearRecipients();
report(); } else if (llSubStringIndex(message, SET_FUNDS_CHAT_PREFIX) == 0) { string params = llDeleteSubString( message, 0, llStringLength(SET_FUNDS_CHAT_PREFIX)-1);
startingFunds = (integer)params; fundsLeft = startingFunds;
report(); } else if (llSubStringIndex(message, SET_AMOUNT_CHAT_PREFIX) == 0) { string params = llDeleteSubString( message, 0, llStringLength(SET_AMOUNT_CHAT_PREFIX)-1);
giveAmount = (integer)params;
report(); } }
touch_start(integer nDetected) { integer i; for (i = 0; i < nDetected; ++i) { processTouch(llDetectedKey(i)); } }
timer() { cleanupRecipients(); } }
Enjoy!
|
|
Nicolette Beebe
Registered User
Join date: 8 Feb 2007
Posts: 18
|
12-27-2008 05:01
I have to say I am not a really big fan of scripts that generate huge lists then have to check them each time an event needs to happen. I think your intention is to get lots of people to this place or something and the more the better. Hopefully it will work for you. I think I will try it just for kicks but maybe instead of paying 10L once a day, modified so it pays 1L once per hour. So the list can remain fairly tame. Also beware of bots. I am pretty sure they can touch and when they get wind of your thing they will come by the hundreds to touch you object for pay. Maybe consider some simple dialog before payment 
|
|
Ryak Ulrik
Registered User
Join date: 8 Jan 2009
Posts: 4
|
Question about llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
01-08-2009 14:55
Hey guys, new SLer and new scripter here(although I'm very good with vb.net/java/c#).
Does llRequestPermissions(llGetOwner(), PERMISSION_DEBIT); (when using a prim to pay money to a client) generate a permission popup box on the object owner's(me) screen?
IE, if I am offline and someone activates the script to get paid, does it pay them or do I have to be online to authorize it?
Also, on a side note, I've seen some blogs/articles saying you can't dynamically set the amount of L$ to pay out? IE if I wanted the script code to generate the number to pay out, and would pay out differently based on who was touching it. Is this true? Or am I reading wrong?
Thanks for your help!
|