Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Defense How_to_make_a_attachable_Demo  

How_to_make_a_attachable_Demo

For objects that do not need permissions to be used.

Rez object on ground, drop in this script, it will request permissions to attach, and then attach to the left hand, if permission is granted. If permission is denied, then the script complains.

Copyright © 2009 Linden Research, Inc. Licensed under Creative Commons Attribution-Share Alike 3.0

Category: Defense
By : Ferd Frederix
Created: 2013-05-02 Edited: 2013-05-02
Worlds: Second Life

the Zip file

Download all files for How_to_make_a_attachable_Demo
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. How_to_make_a_attachable_Demo_1.lsl
Get file # 2. How_to_make_a_attachable_Demo_2.lsl
Get file # 3. How_to_make_a_attachable_Demo_3.lsl
Get file # 4. How_to_make_a_attachable_Demo_4.lsl

This script by Ferd Frederix may be used in any manner, modified, and republished.  Unless specified otherwise, my scripts are always free and open source.  Objects made with these scripts may be sold with no restrictions.  All I ask is that you point others to this location should they ask you about it and to not sell this script, unless it is for $0 L. Please help improve my work by reporting bugs and improvements.

1 default
2 {
4 {
6 }
7
8 run_time_permissions( integer vBitPermissions )
9 {
10 if( vBitPermissions & PERMISSION_ATTACH )
11 {
12 llAttachToAvatarTemp( ATTACH_LHAND );
13 }
14 else
15 {
16 llOwnerSay( "Permission to attach denied" );
17 }
18 }
19
20 on_rez(integer rez)
21 {
23 { //reset the script if it's not attached.
25 }
26 }
27
28 attach(key AvatarKey)
29 {
30 if(AvatarKey)
31 {//event is called on both attach and detach, but Key is only valid on attach
32 integer test = llGetAttached();
33 if(test) {
34 llOwnerSay( "The object is attached" );
35 } else {
36 llOwnerSay( "The object is not attached");
37 }
38 }
39 }
40 }

How_to_make_a_attachable_Demo

This example can demonstrate ownership transfer of an object on a temporary basis using llAttachToAvatarTemp(). Whoever touches will be asked for permission to attach, and upon granting permission will have the item attach, but not appear in Inventory.

Copyright © 2009 Linden Research, Inc. Licensed under Creative Commons Attribution-Share Alike 3.0

Category: Defense
By : Ferd Frederix
Created: 2013-05-02 Edited: 2013-05-02
Worlds: Second Life


This script by Ferd Frederix may be used in any manner, modified, and republished.  Unless specified otherwise, my scripts are always free and open source.  Objects made with these scripts may be sold with no restrictions.  All I ask is that you point others to this location should they ask you about it and to not sell this script, unless it is for $0 L. Please help improve my work by reporting bugs and improvements.

1 default
2 {
3 touch_start(integer num_touches)
4 {
6 }
7
8 run_time_permissions( integer vBitPermissions )
9 {
10 if( vBitPermissions & PERMISSION_ATTACH )
11 {
12 llAttachToAvatarTemp( ATTACH_LHAND );
13 }
14 else
15 {
16 llOwnerSay( "Permission to attach denied" );
17 }
18 }
19
20 on_rez(integer rez)
21 {
23 { //reset the script if it's not attached.
25 }
26 }
27 }

How_to_make_a_attachable_Demo

/ This example illustrates how to handle permissions before and after llAttachToAvatarTemp has been called. Because ownership changes when the object is attached, the initial PERMISSION_ATTACH is revoked and new permissions need to be requested.

Copyright © 2009 Linden Research, Inc. Licensed under Creative Commons Attribution-Share Alike 3.0

Category: Defense
By : Ferd Frederix
Created: 2013-05-02 Edited: 2013-05-02
Worlds: Second Life


This script by Ferd Frederix may be used in any manner, modified, and republished.  Unless specified otherwise, my scripts are always free and open source.  Objects made with these scripts may be sold with no restrictions.  All I ask is that you point others to this location should they ask you about it and to not sell this script, unless it is for $0 L. Please help improve my work by reporting bugs and improvements.

1
2 integer gAttach = TRUE;
3
4 default
5 {
6
8 {
9 if(gAttach) // Object has not been attached yet
10 {
12 gAttach = FALSE;
13 }
14 else // Object has been attached, but you still need PERMISSION_ATTACH in order to detach the object
15 {
17 {
18 llDetachFromAvatar(); // Note that the object vanishes when detached, so there is no need to set gAttach = TRUE again
19 }
20 }
21 }
22
23 attach(key id)
24 {
25 if(id) // Object has been attached, so request permissions again
26 {
28 }
29 }
30
31 run_time_permissions (integer perm)
32 {
33 if(!gAttach) //First time
34 {
35 if(perm & PERMISSION_ATTACH)
36 {
37 gAttach = TRUE;
38 llAttachToAvatarTemp(ATTACH_HEAD); // Initial PERMISSION_ATTACH is revoked at this point
39 }
40 }
41 else // Second time
42 {
44 {
46 }
47 }
48 }
49 }

How_to_make_a_attachable_Demo

An alternative solution: Because ownership changes when the object is attached, the initial PERMISSION_ATTACH is revoked and new permissions need to be requested.

Copyright © 2009 Linden Research, Inc. Licensed under Creative Commons Attribution-Share Alike 3.0

Category: Defense
By : Ferd Frederix
Created: 2013-05-02 Edited: 2013-05-02
Worlds: Second Life


This script by Ferd Frederix may be used in any manner, modified, and republished.  Unless specified otherwise, my scripts are always free and open source.  Objects made with these scripts may be sold with no restrictions.  All I ask is that you point others to this location should they ask you about it and to not sell this script, unless it is for $0 L. Please help improve my work by reporting bugs and improvements.

1 default
2 {
4 {
7 }
8 attach(key id)
9 {
11 }
12 run_time_permissions (integer perm)
13 {
14 if(!llGetAttached() && (perm & PERMISSION_ATTACH)) llAttachToAvatarTemp( ATTACH_NOSE);
16 }
17 }

Back to the Best Free Tools in Second Life and OpenSim.