Difference between revisions of "User:Toady Nakamura/Simple Recording Tipjar"
Jump to navigation
Jump to search
m (added Simple Recording Tipjar script for basic scripts reference) |
m (added a couple nifty functions) |
||
Line 1: | Line 1: | ||
*Put this script in any object you own for an instant tipjar. | *Put this script in any object you own for an instant tipjar. | ||
*By [[User:Toady Nakamura|Toady Nakamura]] | |||
<lsl> | <lsl> | ||
Line 17: | Line 18: | ||
} | } | ||
money(key id, integer amount) | money(key id, integer amount)// When someone pays the system records their key & the amount | ||
{ | { | ||
totaldonated = totaldonated + amount; | totaldonated = totaldonated + amount; | ||
// add the amount just given to the total from before | // add the amount just given to the total from before | ||
Line 28: | Line 27: | ||
// set the text to show the gift | // set the text to show the gift | ||
llInstantMessage(id,"Thank you for the donation!"); | llInstantMessage(id,"Thank you for the donation!, " + llKey2Name(id)); | ||
// send a private thank you to giver. | // send a private thank you to giver. | ||
// "id" comes from the money event | // "id" comes from the money event | ||
llInstantMessage(llGetOwner(), llKey2Name(id) + " just donated $L" + (string)amount); | |||
// privately message owner to say how much the donation was and the name of the giver. | |||
} | } | ||
} | } | ||
</lsl> | </lsl> |
Revision as of 17:53, 18 May 2012
- Put this script in any object you own for an instant tipjar.
- By Toady Nakamura
<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 the system records their key & the amount { 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!, " + llKey2Name(id)); // send a private thank you to giver. // "id" comes from the money event
llInstantMessage(llGetOwner(), llKey2Name(id) + " just donated $L" + (string)amount); // privately message owner to say how much the donation was and the name of the giver. }
} </lsl>