Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Tipjar question..

Malina Chuwen
Evotive
Join date: 25 Apr 2008
Posts: 502
05-28-2008 10:46
Generic title so I can edit to ask more if needed =p Lol.

Alright, I've tried for days now.. I've hunted and looked around but I just can't find anything useful. My question is simple: How do I set it to show last tip/donated? I've messed around with integers, and have tried using and tinkering with parts from vendor and 'goal' scripts but none of those work either.

SL's scripting makes absolutely no sense to me.. Anyone willing to help a gal out? Even pointers would be lovely.

My current script:

key line1;

key keyactive;
string nameactive;

key splitwith;
integer percentage;

default
{
on_rez(integer param)
{
llResetScript();
}

state_entry()
{
line1 = llGetNotecardLine("config",0);
llSetText("Tip jar intactive", <1,1,1> ,1.0);
}

dataserver(key queryid, string data)
{
if (queryid == line1)
{
list templist = llParseString2List(data, [" "],[]);
splitwith = (key) llList2String(templist,0);
percentage = (integer) llList2String(templist,1);
llOwnerSay("Profit will be split with: "+llKey2Name(splitwith)+". Person will receive: "+(string) percentage+"%.";);

llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
}
}

run_time_permissions (integer perm)
{
if (perm == PERMISSION_DEBIT)
{
state active;
} else
{
llOwnerSay("I need those permissions. Please reset me to try again.";);
}
}

}

state active
{
on_rez(integer param)
{
llResetScript();
}

state_entry()
{
llSetText("Tip jar unassigned",<1,1,1>,1.0);
llSetPayPrice(PAY_HIDE, [PAY_HIDE, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
}


touch_start(integer nr)
{
key toucher = llDetectedKey(0);
if (!llSameGroup(toucher))
{
return;
}

if (toucher == keyactive)
{
keyactive = NULL_KEY;
nameactive = "";
llSetText("Tip jar unassigned",<1,1,1>,1.0);
llSetPayPrice(PAY_HIDE, [PAY_HIDE, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
} else
{
keyactive = toucher;
nameactive = llKey2Name(toucher);
llSetText(nameactive+"'s tip jar",<1,1,1>, 1.0);
llSetPayPrice(PAY_DEFAULT, [PAY_DEFAULT, PAY_DEFAULT, PAY_DEFAULT, PAY_DEFAULT]);
}

}

money(key id, integer amount)
{
integer split = llRound((amount * percentage) / 100);
integer tipreceiver = amount - split;
llGiveMoney(keyactive, tipreceiver);
if (splitwith != llGetOwner())
llGiveMoney(splitwith, split);


llSay(0,"Thank you for your donation.";);
}
}
Luke Poplin
Registered User
Join date: 2 Feb 2007
Posts: 32
05-28-2008 10:58
Add the end of the money event:

CODE

llSetText(nameactive + "'s Tip Jar\nLast Tip: " + llKey2Name(id) + " $L" + (string)amount, <1, 1, 1>, 1);


~edit for typo
Malina Chuwen
Evotive
Join date: 25 Apr 2008
Posts: 502
05-28-2008 18:50
Oh, thank you so much!! =) It works perfect, lol.