Jump to content

i have a Script For a Tip Jar but i have a question about the coding,Any Help is appreciated!


Luxz Blessed
 Share

You are about to reply to a thread that has been inactive for 4088 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

i have this script  for a tip jar

default
{
state_entry()
{
llSetPayPrice(5, [10,50,100]);
}

money(key id, integer amount)
{
llInstantMessage(id, "Thanks for the tip!!";);
}
}

 

i am new to scripting so please bare through this with me lol ... ok so, if i input this into a object i made would it work properly or  would i have to input some key id  where it says ''key id'' ?  and is there a way so that i don't have to be the owner for it to work? because i want to sell the jar object i make (for a very low amount since i am practicing)...  how do i set it  so that  the person who purchases it becomes the owner  i want the person to be able to work all its functions and get the money from the tip jar ...but keeping the jar locked from anyone else that might take the money.

i know this must sound really dumb.. and maybe i dont make sence ,but i only have some expirence in making objects i never tried scripting before.

thanks for the help!

Link to comment
Share on other sites

event variables are filled by the thing that triggers them, so no.

 

in short, if you see "key", "string", "list", "integer", 'float", "vector", or "rotation" by itself in front of another word, never ever mess with that (anything after = in that patern may be fair game though)

Link to comment
Share on other sites

Here are some answers to your questions:

  • id automatically is the id of the payer - this parameter is passed by the noney event - you don't have to do a thing
  • as soon as you pass the thing to someone else, this ava bacomes the owner. The owner always gets the money - or the group the object is deeded to
  • there are several ways:
    - you give the buyer a copy - the original object stays your object. You can use llGiveInventory for it e.g.
    - A different way would be to simply set the object's properties accordingly and sell it without using a script.
  • As soon as the object is given to someone, it's his/or her object. 
  • Take a look at the object's properties. You can set what the next owner can do
  • Like 1
Link to comment
Share on other sites

Ok I Tried it Out And It's Not Working

default
{
state_entry()
{
llSetPayPrice(5, [10,50,100]);
}

money(key id, integer amount)
{
llInstantMessage(id, "Thanks for the tip, Brightest Blessings!"; );
}
}

 

 

i  am getting a syntax error

here is the exact error i am getting:

(9,63) :ERROR:  syntax error

 

but when i remove the  ;   after blessings!"  it does not  give me a error  anymore  but  the object  is  still not giving me the option to  give money to the jar  .. what am i doing wrong?

Link to comment
Share on other sites

Put it in the same one. If the text is static, put it in the state_entry event - else you put it in the money event

integer giSum;default{	state_entry()	{		llSetClickAction(CLICK_ACTION_PAY);		llSetPayPrice(5, [10,50,100]);	}		money(key id, integer amount)	{		llInstantMessage(id, "Thanks for the tip, Brightest Blessings!" );                giSum += amount;                llSetText("Happy tip jar - click me to donate!\nSo far, we have collected " + (string)giSum + " L$", <1, 0, 0>, 1.0);	}}

 

Link to comment
Share on other sites

It should show - but only after the first donation ;)

integer giSum;default{	state_entry()	{		llSetClickAction(CLICK_ACTION_PAY);		llSetPayPrice(5, [10,50,100]);		llSetText("Happy tip jar - click me to donate!\nSo far, we have collected 0 L$", <1, 0, 0>, 1.0);	}		money(key id, integer amount)	{		llInstantMessage(id, "Thanks for the tip, Brightest Blessings!" );                giSum += amount;                llSetText("Happy tip jar - click me to donate!\nSo far, we have collected " + (string)giSum + " L$", <1, 0, 0>, 1.0);	}}

 

  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4088 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...