Sets the action performed when a prim is clicked upon (aka click action).
void llSetClickAction( integer action );
integer CLICK_ACTION_ZOOM = 7;//Zoom
Forced delay: 0.0 seconds. Energy: 10.0.
When the cursor hovers over the prim, its image changes to reflect the action.
| Flag | Description | Cursor | |
|---|---|---|---|
| CLICK_ACTION_NONE | 0 | Performs the default action: when the prim is touched, touch events are triggered | |
| CLICK_ACTION_TOUCH | 0 | When the prim is touched, touch events are triggered | |
| CLICK_ACTION_SIT | 1 | When the prim is touched, the avatar sits upon it | |
| CLICK_ACTION_BUY | 2 | When the prim is touched, the buy dialog is opened | |
| CLICK_ACTION_PAY | 3 | When the prim is touched, the pay dialog is opened | |
| CLICK_ACTION_OPEN | 4 | When the prim is touched, the object inventory dialog is opened | |
| CLICK_ACTION_PLAY | 5 | Play or pause parcel media on touch | |
| CLICK_ACTION_OPEN_MEDIA | 6 | Play parcel media on touch, no pause | |
| CLICK_ACTION_ZOOM | 7 | Zoom the avatar camera on this object (Viewer 2) | |
| CLICK_ACTION_DISABLED | 8 | No click action. No touches detected or passed. | |
| CLICK_ACTION_IGNORE | 9 | Clicks go through the object to whatever is behind it. No touches detected. |
| make sitting easier | make unpacking for next owner easier | make buying for customers easier |
|---|---|---|
| | |
// simple tipjar
default
{
state_entry()
{
llSetClickAction(CLICK_ACTION_PAY);
// enabled edit field to put own amount, all quick-pay-buttons hidden
llSetPayPrice(PAY_DEFAULT, [PAY_HIDE, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
}
money(key id, integer amount)
{
string name = llKey2Name(id);
llInstantMessage(id, "Thank you for the tip, " + name + "!");
}
}
//Sit Only with Permission
list gAvWhitelist = ["953d10f1-44ce-462a-8bc1-f634333ee031", "599dce91-a2b8-48c5-b96d-54965433022b"];
default
{
state_entry()
{
llSitTarget(<0.0, 0.0, 0.5>, ZERO_ROTATION);
}
changed(integer change)
{
if (change & CHANGED_LINK)
{
list Properties = llGetObjectDetails(llGetKey(), [OBJECT_CLICK_ACTION]);
integer Click = llList2Integer(Properties, 0);
key Av = llAvatarOnSitTarget();
if ((Av != NULL_KEY) && (!Click))
{
llSay(0, "Please click first for permission to sit.");
llUnSit(Av);
}
}
}
touch_start(integer total_number)
{
list Properties = llGetObjectDetails(llGetKey(), [OBJECT_CLICK_ACTION]);
integer Click = llList2Integer(Properties, 0);
if (!Click && (~llListFindList(gAvWhitelist, [(string)llDetectedKey(0)])))
{
llSetClickAction(CLICK_ACTION_SIT);
llSetTimerEvent(10.0);
llSay(0, "Please take a seat.");
}
else
{
llSetClickAction(CLICK_ACTION_TOUCH);
if (llAvatarOnSitTarget() != NULL_KEY)
{
llSay(0, "Good bye!");
}
else
{
llSay(0, "Sorry. You are not allowed to sit here.");
}
llUnSit(llDetectedKey(0));
}
}
timer()
{
llSetTimerEvent(0.0);
llSetClickAction(CLICK_ACTION_TOUCH);
}
}