Jump to content

Donation/payment script with avatar log?


Queenship3001
 Share

You are about to reply to a thread that has been inactive for 3448 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hello again SL scripting community ^.^ I once again need a bit of help.

 

I have a script for payments that I will be using for commercial purposes, donations and such, but I'm giving little thank you's and stuff to the people that donate over a certain ammount.

default
{
    touch_start(integer num_detected)
    {
        llRegionSayTo(llDetectedKey(0), 0, "Please right-click me and select 'Pay...' to donate.");
    }
 
    money(key id, integer amount)
    {
        string name = llKey2Name(id);
 
        key owner = llGetOwner();
 
        llInstantMessage(id, "Thank you for your donation, " + name + "!");
        llInstantMessage(owner, name + " has donated " + (string)amount + " L$.");
    }
}

 This is a script I found in the library, simple and easy, but is there a way to have the script record who has payed the object and how much? Any help is appreciated.

Link to comment
Share on other sites

You make a list:

list names;

You add the names to the list after you grab them with llKey2Name

names += name;

Now you need to be able to get the names out and you have to be able to clear the list so that it doesn't run out of memory.

Take a look at this visitors list script which you can easily adapt to do what you want.

http://www.free-lsl-scripts.com/cgi/freescripts.plx?ID=956

 

Link to comment
Share on other sites

First of all you need to reflect on how you want to give the people your thank-you object. Do you want to use a script that gives it automatically? Or do you want to go through the list, copy & paste every single one and send it personally? That could add up to a lot of work and effort over time.

Secondly, do you want to give everyone a gift, who paid more than a certain threshhold? Or do you want to decide on a case by case basis?

Scenario 1) Let's say you want to decide on a case to case basis if you want to give a gift. And you send it to every person manually. Then you need to work with strided lists.

http://wiki.secondlife.com/wiki/Category:LSL_List#Strided_lists

Here you need a grouping of two strides: list donations = [nameXY, paymentXY...]

Instead of making a list names, you start with the list myDonations:

Then you add after each payment the name of the donator and as a second new entry the amount of the payment.

 

myDonations += [User, Payment]; 

Then you can let the script say the list in chat or write it on a notecard. And you go through it name by name and amount by amount.

Scenario 2) You think about your metrics before you start scripting. Let's say that you will have 3 levels of gifts. You will give a "small" gift to everyone paying between 100LS and 250LS, a "medium" gift to everyone paying 250LS to 1000LS and a "big" gift to everyone who pays more than 1000LS.

Then you don't have to work with a strided list, but with three single lists. Everyone who pays less than 100LS would not be saved, which saves you script memory.

Don't list the names. Use llGiveInventory e.g. in combination with a listener and a command on a negative channel, then you can give everyone on the list the object in an automated process (if you are able to script that). In order to do that, you won't need the names but the key of the people who donated.

 

list myDonationsSmall;list myDonationsMedium;list myDonationsBig;

 You make an if-else chain to identify, if the key of the donator goes into one of the three lists:

default {    money(key giver, integer amount) {        if ((amount > 99))&&((amount < 250))    myDonationsSmall += giver;else if ((amount > 249))&&((amount < 1000))    myDonationsMedium += giver;else if (amount > 999)    myDonationsBig += giver;    }}

 Now you have the keys of all people donating more than a certain threshold. If you don't feel confident to script an automatic inventory distributor, then you can always save the names with llKey2Name instead.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3448 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...