Jump to content

Script for Payment Amounts in a Tip Jar


achem Serenity
 Share

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

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

Recommended Posts

Thanks for your response.

This is the script:

integer pot; integer amount; integer total; key tid; string ownername;

init() {     ownername = llKey2Name( llGetOwner());     llSetText( "Tips",<0,1,0>,1);     llOwnerSay ( "Tip jar for " + ownername + " ready..." ); }

default {     state_entry()     {         init();     }     on_rez( integer param )     {         init();     }     touch_start( integer num )     {         llInstantMessage( llDetectedKey(0),"Leave a Tip if you enjoyed");     }     money( key id, integer payment )     {         amount = payment;         tid = id;         llRequestAgentData( id, DATA_NAME );     }     dataserver( key query, string name )     {         llSay( 0, name + " tips " + ownername + " " + (string)amount + "Lindens");         llSay( 0, "Thanks " + llGetSubString( name, 0, llSubStringIndex( name, " " )) );         llInstantMessage( tid, "Thanks for your Tip " + llGetSubString( name, 0, llSubStringIndex( name, " " )));         if ( llGetInventoryNumber( INVENTORY_SOUND ) > 0 )         {             llPlaySound( llGetInventoryName( INVENTORY_SOUND, 0 ),1 );         }         if ( llGetInventoryNumber( INVENTORY_TEXTURE ) > 0 )         {             llGiveInventory( tid,llGetInventoryName( INVENTORY_TEXTURE,0 ));         }             } }

 

 

 

Link to comment
Share on other sites

Wow....thanks.   OK, so here's a clean version that we can read.  Now what's the question, other than "Why do you need a dataserver event and two of the three global integer variables in this script" ?

integer pot;integer amount;integer total;key tid;string ownername;init(){	ownername = llKey2Name( llGetOwner());	llSetText( "Tips",<0,1,0>,1);	llOwnerSay ( "Tip jar for " + ownername + " ready..." );}default{	state_entry()	{		init();	}	on_rez( integer param )	{		init();	}	touch_start( integer num )	{		llInstantMessage( llDetectedKey(0),"Leave a Tip if you enjoyed");	}	money( key id, integer payment )	{		amount = payment;		tid = id;		llRequestAgentData( id, DATA_NAME );	}	dataserver( key query, string name )	{		llSay( 0, name + " tips " + ownername + " " + (string)amount + "Lindens");		llSay( 0, "Thanks " + llGetSubString( name, 0, llSubStringIndex( name, " " )) );		llInstantMessage( tid, "Thanks for your Tip " + llGetSubString( name, 0, llSubStringIndex( name, " " )));		if ( llGetInventoryNumber( INVENTORY_SOUND ) > 0 )		{			llPlaySound( llGetInventoryName( INVENTORY_SOUND, 0 ),1 );		}		if ( llGetInventoryNumber( INVENTORY_TEXTURE ) > 0 )		{			llGiveInventory( tid,llGetInventoryName( INVENTORY_TEXTURE,0 ));		}	}}

 

 

Link to comment
Share on other sites

Since the giver is going to be on the same sim as the tipjar, at least under normal circumstances, you can get the name in the money event, something like this:

money(key giver, integer amount)	{		string name = llGetDisplayName(giver);		llSay(0,"Thank you for the generous tip, "+name+",!");	}

 No need to mess around with dataservers.  

I would recommend using llGetDisplayName in this context, since the giver knows that's the name she or he is using, and would probably rather be thus addressed than as "joe123 Resident."  

Link to comment
Share on other sites


achem Serenity wrote:

Thanks for your help.

I never tried scripting before, so I don't know how to fit the script into the already exisintg script with the brackets and title.  Can you show me how to fit this into the existing script.

 

Almost anywhere, but the logical place is in your init() function, so that it's done once as the script is reset.

Link to comment
Share on other sites

  • 2 years later...

I don't think so.   You've run into the bug VWR-3048,  llSetPayPrice doesn't work on ChildPrims, which was reported in 2007 and still hasn't been fixed.

It may be possible to juggle things around so the tip jar doesn't break your other scripts, but certainly you're going to have to have  the llSetPayPrice call (and I think the money event, too, but I may be mistaken)  in the root prim for it to work.

Link to comment
Share on other sites

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

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...