User:Toady Nakamura/Simple Recording Tipjar
Jump to navigation
Jump to search
- Put this script in any object you own for an instant tipjar.
<lsl> integer totaldonated;
default {
on_rez( integer sparam )
{
llResetScript(); // reset when rezzed out
}
state_entry()
{
llSetText("Donation Box\nL$0 Donated so far",<1.0,1.0,1.0>,0.85);
// set text, "message", color vector (here white), and intensity (here 85%)
}
money(key id, integer amount)
{
// When someone pays
totaldonated = totaldonated + amount;
// add the amount just given to the total from before
// "amount" comes from the money event
llSetText("Donation Box \n L$" + (string)totaldonated + " Donated so far",<1.0,1.0,1.0>,0.85);
// set the text to show the gift
llInstantMessage(id,"Thank you for the donation!");
// send a private thank you to giver.
// "id" comes from the money event
}
} </lsl>