User:Tutti Anatine/scripts

From Second Life Wiki
Jump to navigation Jump to search

Pose stand (with buttons)

Tip jar

A simple tip jar script, all donations go to the owner. Inexperienced-user-friendly options include:

  • Change quick pay button values;
  • Set the color of the floating text;
  • Personalized thank you message.

<lsl>/* [*TA*] Tip Jar script By Tutti Anatine

Feel free to edit this code but do not sell it for more than L$0. Keep permissions copy/mod/transfer at all times. Make a copy of the original script before editing the code to prevent loss. If you have been charged money for this script, please contact the seller and ask for full compensation. Please do not remove this text and other comments within this script.

Last edit: 31 July 2011 */ key CREATOR = "95eaa123-5b83-437e-9fe9-90def840da39";

// -------------------- // settings - edit these to suit your taste // --------------------

// constants list QUICK_PAY_BUTTONS = [5,10,20,40]; // the values of the quick page buttons, set value to PAY_HIDE to hide a button | order: top left, top right, bottom left, bottom right vector FLOATING_TEXT_COLOR = <1.0 , 1.0, 1.0>; // color value of floating text | ranges between <1.0 , 1.0, 1.0> (white) and <0.0 , 0.0, 0.0> (black) | order: red, green, blue string THANK_MESSAGE = "Thank you for your donation, I really appreciate it!"; // the private message sent to a donator after donation

// -------------------- // do not edit below this line unless you know what you're doing! // --------------------

// variables key owner; integer donatedThisSession; integer lastDonation; string lastDonator;

// basic setup of script, used instead of llResetScript(); init() {

   owner = llGetOwner();
   donatedThisSession = 0;
   llSetPayPrice(0, QUICK_PAY_BUTTONS);
   updateFloatingText();
   llSetClickAction(CLICK_ACTION_PAY);

}

updateFloatingText() {

   if (donatedThisSession > 0) {
       llSetText(llKey2Name(owner)+"'s Tip Jar\nClick me to donate\nL$"+(string)donatedThisSession+" donated this session\nLast donation: L$"+(string)lastDonation+" by "+lastDonator, FLOATING_TEXT_COLOR, 1.0);
   } else {
       llSetText(llKey2Name(owner)+"'s Tip Jar\nClick me to donate", FLOATING_TEXT_COLOR, 1.0);
   }

}

default {

   state_entry() {
       init();
   }
   
   money(key id, integer amount) {
       donatedThisSession += amount;
       lastDonation = amount;
       lastDonator = llKey2Name(id);
       updateFloatingText();
       llInstantMessage(id, THANK_MESSAGE);
       llInstantMessage(owner,lastDonator+" just donated L$"+(string)lastDonation);
   }
   
   changed(integer change) {
       if (change & CHANGED_OWNER) {
           init();
       }
   }
   
   on_rez(integer start_param) {
       init();
   }

}</lsl>

Unpacker