Tip Jar API

The tip jars offer a link_message API in case you want to customize or extend their functionality.

Within the link_message event of a script you can react to the following messages:

Message Description integer num string str key id
LOG_IN_REQUESTED Sent when the user clicks the "Log In" button in the menu. 31004 The UUID of the agent requesting the log in
LOG_OUT_REQUESTED Sent when the user clicks the "Log Out" button in the menu. 31005 The UUID of the agent requesting the log out
LOG_IN Sent when a log in or log out was approved and the user is actually logged in/out. 30007 The UUID of the agent logged in, or NULL_KEY on log outs
GOAL_PERCENTAGE_UPDATED Sent if the tip jar is set to be a goal tip jar, and the percentage of the goal reached was updated. 32001 The total amount tipped to this tip jar The goal amount

Using the LOG_IN event, you could, e.g., create a tip jar that follows the logged in person around and returns to a default place when the user logs out.
See below for an example script.

Using the GOAL_PERCENTAGE_UPDATED event, you could create a donation thermometer tip jar. You would calculate the percentage with
integer percentage = ((integer) str) * 100) / ((integer) ((string) id));

Examples

Following Tip Jar

vector OFFSET_FROM_AVATAR_CENTER = <0, 0, 1.5>;

vector g_vecHomePosition;


moveTo(vector vecTarget)
{
    integer i = 0;
    for ( ; i < 10; ++i)
    {
        vector vecBefore = llGetPos();
        llSetPos(vecTarget);
        vector vecAfter = llGetPos();

        if (llVecDist(vecAfter, vecTarget) < 0.01 || vecBefore == vecAfter)
            return;
    }
}

default
{    
    state_entry()
    {
        llSetStatus(STATUS_PHYSICS, FALSE);
    }
    
    on_rez(integer nStartParam)
    {
        llResetScript();
    }

    link_message(integer nSenderNum, integer nNum, string strMsg, key keyUUID)
    {
        if (nNum == 30007)
        {
            if (keyUUID)
            {
                // an agent logged in
                g_vecHomePosition = llGetPos();
                llSensorRepeat("", keyUUID, AGENT, 20, PI, 1);
            }
            else
            {
                // the agent logged out
                llSensorRemove();
                moveTo(g_vecHomePosition);
            }
        }
    }
    
    sensor(integer nNum)
    {
        moveTo(llDetectedPos(0) + OFFSET_FROM_AVATAR_CENTER);
    }
    
    no_sensor()
    {
        // move to the home position if the logged in user has left
        llSensorRemove();
        moveTo(g_vecHomePosition);
    }
}