This script adds less sim loading than the popular 3 script tip jar since each script adds sim load.
This script is designed to be used in the one prim tip jar, however it can be used in more complex ones.
The big differance is that the script dies if you are not in the sim.
CODE
//Free open soure Auto die tip jar by grumble Loudon and LaserFur Leonov
//Released into the public domain, no rights reserved.
//
//Created after vewing scripts from Keknehv Psaltery, jean cook, ama omega, nada epoch, YadNi Monde
//
//********************************************************
string m_ownerName;
key m_ownerKey;
integer m_money;
integer m_DieTimer;
//set the floating text,
SetText(string PayeText){
string Text;
Text = m_ownerName + "'s Tip Jar.\n$";
Text += (string)m_money + "L Donated so far\n";
if (llStringLength(PayeText) >= 0){
Text += PayeText;
};
llSetText(Text,<0,0,1>,1);
}//set Text
//********************************************************
default
{
state_entry()
{
llSetStatus(STATUS_BLOCK_GRAB, TRUE);
m_ownerKey = llGetOwner();
m_ownerName = llKey2Name(m_ownerKey);
SetText("");
// llTargetOmega(<0,0,0.075>,PI,0.05); //rotate if desired
llSetTimerEvent(53); //use odd numbers to prevent all scripts in sim from triggering at the same time
}
//*********************************************************8
on_rez(integer RezNumber){
llResetScript();
}
//*********************************************************
money(key id, integer amount)
{
m_money += amount;
SetText("$" + (string)amount + "L Was donated by "+(string)llKey2Name(id)+" last.");
llInstantMessage(id,"Thanks for the tip. :)");
llInstantMessage(m_ownerKey,(string)llKey2Name(id)+" payed $" + (string)amount + "L");
}//money
//*********************************************************
timer()
{
if (llKey2Name(m_ownerKey) == ""){ //he's not in this sim
m_DieTimer++;
if (m_DieTimer > 2 ) { //give him some time, just in case he crashed.
llDie();//he hasn't came back yet
};//
}else{
m_DieTimer =0; //he's back
};//in sim
}//timer
//*********************************************************
}//default