Jump to content
You are about to reply to a thread that has been inactive for 3231 days.

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

Recommended Posts

Posted

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 ));         }             } }

 

 

 

Posted

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 ));		}	}}

 

 

Posted

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."  

Posted

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.

Posted


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.

  • 2 years later...
Posted

Is there a way to make it work if the tip script is in a child prim? When I set the tip as the main prim is messes up the other scripts linked, but when I set it in the child prim of the link its only allowing 1, 5, 10 15 for pay options. 

Posted

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.

You are about to reply to a thread that has been inactive for 3231 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
×
×
  • Create New...