Writing a custom script that responds to a tip event
With the Techno Tip Cube, you can drop in your own script -- into any prim (root prim or otherwise) -- that can perform a custom action when someone tips into the cube. When a tip is made, the Techno Tip Cube will broadcast a linked message #8000 to all prims in the linked set. The message string is a comma-separated list of three fields:
"<tip amount>, <avatar key>, <avatar name>"
Obviously, the possibilities on what your script can do are unlimited! The following is a very simple example.
integer MSGNUM_TIP_RECEIVED = 8000;
string ITEM_NAME_1 = "item name goes here";
string ITEM_NAME_2 = "item name goes here";
default {
link_message( integer sender_num, integer num, string str, key id ) {
if ( num == MSGNUM_TIP_RECEIVED ) {
list tipInfo = llCSV2List( str );
integer amount = llList2Integer( tipInfo, 0 );
key avatarKey = llList2Key( tipInfo, 1 );
string name = llList2String( tipInfo, 2 );
if ( amount >= 100 )
llGiveInventory( avatarKey, ITEM_NAME_1 );
else if ( amount >= 10 )
llGiveInventory( avatarKey, ITEM_NAME_2 );
}
}
}
|
|