Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

The funky tipjar..

Malina Chuwen
Evotive
Join date: 25 Apr 2008
Posts: 502
09-21-2008 10:17
Ok, well, ya'll helped me build it and it worked AWESOME for awhile.. But for some reason, something corrupted and it's rendered itself on permanent vacation =x

Soooo.. Anyone willing to help? =x Lol

It also uses a "avatarkey,percentage" notecard..

--

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);
{
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.";);
}
}
_____________________
-- Please do not PM =) Average wait time for me to notice can be up to a week in some cases, lol. IM/Notecard in game. I do have PMs on but prefer in game.
Ron Khondji
Entirely unlike.
Join date: 6 Jan 2007
Posts: 224
Unreachable code.
09-21-2008 12:17
You should remove the:
From: someone


{
return;
}



from the touch event in state active.

It should look like this:
From: someone


touch_start(integer nr)
{
key toucher = llDetectedKey(0);
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]);
}
}

Malina Chuwen
Evotive
Join date: 25 Apr 2008
Posts: 502
09-21-2008 20:37
YAY!! =D

And I was able to figure out another issue meanwhile too! lol

Thank you SO much!
_____________________
-- Please do not PM =) Average wait time for me to notice can be up to a week in some cases, lol. IM/Notecard in game. I do have PMs on but prefer in game.