Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Discussion: donation box

Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
05-29-2003 16:48
Summary: The following script will make an object accept donations on your behalf.

Usage: stick it on any object you own(my favorite is a top hat), and it will promptly display:

"<your name>'s donation hat.
Donate if you are so inclined."

at which point anyone can right click on it and give you a tip. also, the script tells the donator thanks, and then tells you who donated how much so you can send them a thank you notecard :D


CODE

default
{
state_entry()
{
llSetText(llKey2Name(llGetOwner())+"'s donation hat.\nDonate if you are so inclined!",<1,1,1>,1);
}

money(key id, integer amount)
{
llInstantMessage(id,"Thanks for the tip!");
llInstantMessage(llGetOwner(),llKey2Name(id)+" donated $" + (string)amount);
}
}

Credits:
Script written by:
jean cook, ama omega, and nada epoch 5-29-03

Original Thread
/15/0f/2795/1.html
_____________________
i've got nothing. ;)
Chance Small
Linden PITA
Join date: 30 Jul 2003
Posts: 170
08-26-2003 14:55
There's an error in your code...

This Line:
CODE
llInstantMessage(llGetOwner,llKey2Name(id)+" donated $" + (string)amount);


Needs To Be:
CODE
llInstantMessage(llGetOwner(),llKey2Name(id)+" donated $" + (string)amount);
Raemus Patel
Registered User
Join date: 21 Jun 2004
Posts: 29
06-25-2004 05:40
"and then tells you who donated how much so you can send them a thank you notecard"

Couldn't you just have the hat vend out a notecard saying thanx? That wouldnt requier much added scripting...
Twist Zaius
Junior Member
Join date: 5 Mar 2004
Posts: 8
07-06-2004 11:10
You probably going to be wanting to add this event too:

CODE

on_rez(integer start)
{
llResetScript();
}
_____________________
I'm everything thats wrong with the world
Goshua Lament
Registered User
Join date: 25 Dec 2003
Posts: 703
07-25-2004 10:25
From: someone
Originally posted by Raemus Patel
Couldn't you just have the hat vend out a notecard saying thanx? That wouldnt requier much added scripting...


All you have to do is add a llGiveInventory line inside the money event. Just add
CODE
llGiveInventory(llDetectedKey(0),_llGetInventoryName(INVENTORY_NOTECARD,_0));


after the llInstantMessage. Yes, it is pretty easy scripting.
_____________________
Flickr Second Life Photo Gallery

I no longer regularly login to SecondLife, but please contact me if an issue arises that needs my attention.
Camden Callahan
Registered User
Join date: 25 Jul 2004
Posts: 4
07-30-2004 19:14
From: someone
Originally posted by Raemus Patel
"and then tells you who donated how much so you can send them a thank you notecard"

Couldn't you just have the hat vend out a notecard saying thanx? That wouldnt requier much added scripting...


I'm sure the donator would prefer a card written and sent by the actual person instead of just automated. It shows that you actually care enough about it to do it yourself...
Lazerus Glitterbuck
Wascally Wabbit
Join date: 6 Jan 2005
Posts: 14
04-28-2005 17:58
Sorry to dig up an old thread but I though better to do this than make a new post.
Does anyone know how I can modify this script so that it shows a running total?
Davy Flytrap
Registered User
Join date: 21 Feb 2005
Posts: 146
05-31-2005 08:06
Laz..if you IM me ingame i have made one that totals up all donations
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
05-31-2005 10:19
CODE

integer totaldonated;
string owner;

default
{
on_rez( integer sparam )
{
llResetScript();
}
state_entry()
{
owner = llKey2Name( llGetOwner() );
llSetText( owner + "'s donation hat.\nDonate if you are so inclined!\n$0 Donated so far",<1,1,1>,1);
}

money(key id, integer amount)
{
totaldonated+=amount;
llSetText( owner + "'s donation hat.\nDonate if you are so inclined!\n$" + (string)amount + " Donated so far",<1,1,1>,1);
llInstantMessage(id,"Thanks for the tip!");
llGiveInventory(llDetectedKey(0),_llGetInventoryNa me(INVENTORY_NOTECARD,_0));
llInstantMessage(llGetOwner,llKey2Name(id)+" donated $" + (string)amount);
}
}


There you go.. Although I do wonder, why did it take 3 people to code this?
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
05-31-2005 13:15
back in beta, everything took longer and more people :D
_____________________
i've got nothing. ;)
Cherry Took
Mud Wrestling Champeeeen
Join date: 7 Jan 2005
Posts: 160
Holy Cow!
05-31-2005 17:03
Willya look at Nada Epoch's join date? (emits low whistle) Beaut! lol
Hiro Pendragon
bye bye f0rums!
Join date: 22 Jan 2004
Posts: 5,905
06-02-2005 01:42
CODE
default{state_entry(){llSetText("Gimme ur $$",<1,1,1>,1);}money(key i, integer a){}}
_____________________
Hiro Pendragon
------------------
http://www.involve3d.com - Involve - Metaverse / Emerging Media Studio

Visit my SL blog: http://secondtense.blogspot.com