Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Floating Tip Jar Help Please

Lextacy Poitier
Registered User
Join date: 4 Jan 2007
Posts: 4
09-19-2009 23:33
Hello,

I was wondering if someone would be willing to tell me how or point me to the proper forum to learn how to create a floating tip jar. I've never created anything in SL so this will be my first creation experience. Any help would be greatly appreciated.

Thank You
EF Klaar
Registered User
Join date: 11 Jun 2007
Posts: 330
09-19-2009 23:43
By "floating", do you mean a jar that follows the owner around, or one that just hangs in the air somewhere convenient?
Lextacy Poitier
Registered User
Join date: 4 Jan 2007
Posts: 4
09-19-2009 23:59
I mean one that follows you around. Sorry. I should have been more clear on that. >.<
EF Klaar
Registered User
Join date: 11 Jun 2007
Posts: 330
09-20-2009 00:30
Not having done much scripting of physics or money, your question got me interested so I came up with this script based on examples in the LSL wiki at

http://wiki.secondlife.com/wiki/LSL_Portal

CODE

default
{
on_rez (integer parameter)
{
llResetScript ();
}
state_entry ()
{
llSetText ("Touch me to tip me!", <1.0, 1.0, 1.0>, 1.0);
llSetClickAction (CLICK_ACTION_PAY);
llSetStatus (STATUS_PHYSICS | STATUS_PHANTOM, TRUE);
llSensorRepeat ("", llGetOwner (), AGENT, 20.0, PI, 2.0);
}
sensor (integer number)
{
llMoveToTarget (llDetectedPos (0) + <0.0, 0.0, 2.0>, 2.0);
}
no_sensor ()
{
llOwnerSay ("Waah!");
llDie ();
}
money (key id, integer amount)
{
llOwnerSay (llKey2Name (id) + " has paid you L$" + (string) amount + ".");
llInstantMessage (id, "Thank you.");
}
}

This is a very basic script that seems to cover the basics. I haven't commented it, but since the LSL functions I've used all seem to have meaningful names, it's vaguely self-explanatoty. I look forward to seeing it ripped to shreds in subsequent posts :)

(Afterthought) It might make sense to make the jar phantom as well or something's bound to get broken in all the whizzing around. I changed the llSetStatus call to reflect this. And in the interests of common courtesy, I've added the no_sensor event to delete the jar should it get seperated from its owner.
Indeterminate Schism
Registered User
Join date: 24 May 2008
Posts: 236
09-20-2009 09:36
Really, really, simple way, if you want it that way ...
Don't make it a follower, just wear it as an attachment over your head.
Only script required is:

default
{
money(key Payee, integer Amount)
{
llSay(0, "Thanks for the tip, " + llKey2Name(Payee));
}
}

Edit: Er, I think. Can't remember if you can actually pay attachments or not
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
09-20-2009 09:57
Ooops.... I had a small improvement to suggest, but then I remembered (like Indeterminate) that you can't pay attachments. SO much for that. :rolleyes:
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at