Difference between revisions of "LlSetClickAction"

From Second Life Wiki
Jump to navigation Jump to search
m (script that was on the page had too much stuff in the params list, so removed that. Added simpler examples instead.)
m (Replaced old <LSL> block with <source lang="lsl2">)
Line 15: Line 15:
! '''make buying for customers easier'''
! '''make buying for customers easier'''
{{!}}-
{{!}}-
{{!!}}<lsl>
{{!!}}<source lang="lsl2">
default
default
{
{
Line 24: Line 24:
     }
     }
}
}
</lsl>
</source>
{{!!}}
{{!!}}
<lsl>
<source lang="lsl2">
default
default
{
{
Line 35: Line 35:
     }
     }
}
}
</lsl>
</source>
{{!!}}
{{!!}}
<lsl>
<source lang="lsl2">
//  remember you'll have to set a price
//  remember you'll have to set a price
//  in the general tab of the edit window
//  in the general tab of the edit window
Line 50: Line 50:
     }
     }
}
}
</lsl>
</source>
{{!}}}
{{!}}}
<lsl>
<source lang="lsl2">
//  simple tipjar
//  simple tipjar


Line 72: Line 72:
     }
     }
}
}
</lsl>
</source>
|spec
|spec
|constants=<div id="box">
|constants=<div id="box">

Revision as of 13:47, 22 January 2015

Summary

Function: llSetClickAction( integer action );
0.0 Forced Delay
10.0 Energy

Sets the action performed when a prim is clicked upon (aka click action).

• integer action CLICK_ACTION_* flag

When the cursor hovers over the prim, its image changes to reflect the action.

Constants

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 SitActionCursor.png
CLICK_ACTION_BUY 2 When the prim is touched, the buy dialog is opened SaleOneclickCursor.png
CLICK_ACTION_PAY 3 When the prim is touched, the pay dialog is opened SaleOneclickCursor.png
CLICK_ACTION_OPEN 4 When the prim is touched, the object inventory dialog is opened OpenOneclickCursor.png
CLICK_ACTION_PLAY 5 Play or pause parcel media on touch Toolplay.png
CLICK_ACTION_OPEN_MEDIA 6 Play parcel media on touch, no pause Toolmediaopen.png
CLICK_ACTION_ZOOM 7 Zoom (Viewer 2) Toolzoom.png

Caveats

  • When set in the root of an object the chosen CLICK_ACTION_* will be that for the children also even if they have their own llSetClickAction set (it will be over-ridden). However (in the case of touch for example) if the CLICK_ACTION_* is set in the root but not at all in the children (including not having touch event scripts in them (this creates a default CLICK_ACTION_TOUCH)) the effect of the roots CLICK_ACTION_* is not seen but the CLICK_ACTION_* is used on clicking. To both use and see the correct cursor the CLICK_ACTION_* flags must match in the children and root.
  • If llSetClickAction is CLICK_ACTION_PAY then you must have a money event, or it will revert to CLICK_ACTION_NONE.
  • While this function works or attached objects (click action can be changed), the configured click action of an attachment is ignored by the viewer. The viewer always behaves as though an attached object has CLICK_ACTION_TOUCH set.

Examples

make sitting easier make unpaking for next owner easier make buying for customers easier
default
{
    state_entry()
    {
        llSetClickAction(CLICK_ACTION_SIT);
        llRemoveInventory(llGetScriptName());
    }
}
default
{
    state_entry()
    {
        llSetClickAction(CLICK_ACTION_OPEN);
        llRemoveInventory(llGetScriptName());
    }
}
//  remember you'll have to set a price
//  in the general tab of the edit window
//  for your object before using this script

default
{
    state_entry()
    {
        llSetClickAction(CLICK_ACTION_BUY);
        llRemoveInventory(llGetScriptName());
    }
}
//  simple tipjar

default
{
    state_entry()
    {
        llSetClickAction(CLICK_ACTION_BUY);

    //  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 + "!");
    }
}

See Also

Events

•  touch_start
•  touch
•  touch_end

Functions

•  llPassTouches

Articles

•  Detected

Deep Notes

History

Signature

function void llSetClickAction( integer action );
integer CLICK_ACTION_ZOOM = 7;//Zoom