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
Door Magic Door  

Magic Door

teleporting door

Category: Door
By : Ferd Frederix
Created: 2013-09-06 Edited: 2013-09-04
Worlds: Second Life

the Zip file

Download all files for Magic Door
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Fairy door script.lsl
Get file # 2. moving prim for door.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
2 // Ferd Frederix
3
4
5 integer debug = 1;
6
7
8 float TIME = 6.0;
9 integer channel = -44442; // listener from other prim
10 integer listener; // channel handle
11 string myName; // Name of this prim
12
13 vector DestPosition = <0,0,0.1>; // offset to the other door
14 rotation DestRotation = <0,0,0,1>; // rotation when we get there
15
16 vector MYOFFSET = <1,0,0.1>; // offset to the other door
17 rotation MYROT = <0,0,0,1>; // rotation when we get there
18
19 string animation ;
20
21 key AvatarKey; // key of who touched the door
22
23
24 Tell()
25 {
26 string location = (string) llGetPos() + "|" + (string) llGetRot();
27 if(! debug)
28 llRegionSay(channel,location);
29 else
30 llSay(channel,location);
31 }
32
33 Go()
34 {
35 if(debug) llOwnerSay("starting animation");
36 llStartAnimation(animation);
37 llSleep(TIME);
38 if(debug) llOwnerSay("starting movement to " + (string )DestPosition);
39 warpPos();
40
41 if(debug) llOwnerSay("ending animation");
42 llSleep(TIME);
43 llStopAnimation(animation);
44 llUnSit(AvatarKey);
45
46 string location = (string) llGetPos() + "|" + (string) llGetRot();
47 if(debug)
48 llOwnerSay(location);
49 else
50 llRegionSay(channel,location);
51
52 }
53
54 warpPos()
55 { //R&D by Keknehv Psaltery, 05/25/2006
56 //with a little poking by Strife, and a bit more
57 //some more munging by Talarus Luan
58 //Final cleanup by Keknehv Psaltery
59 //Changed jump value to 411 (4096 ceiling) by Jesse Barnett
60 // Compute the number of jumps necessary
61 // rotated by Ferd Frederix
62 //llSitTarget(destpos, ROT);//Set the sit target
63 integer jumps = (integer)(llVecDist(DestPosition, llGetPos()) / 10.0) + 1;
64 // Try and avoid stack/heap collisions
65 if(jumps > 411)
66 jumps = 411;
67 list rules = [ PRIM_POSITION, DestPosition ]; //The start for the rules list
68 integer count = 1;
69 while( ( count = count << 1 ) < jumps)
70 rules = (rules=[]) + rules + rules; //should tighten memory use.
71 llSetPrimitiveParams( rules + llList2List( rules, (count - jumps) << 1, count) );
72 if( llVecDist( llGetPos(), DestPosition ) > .001 ) //Failsafe
73 while( --jumps )
74 llSetPos( DestPosition );
75 if(debug)
76 llOwnerSay("open");
77 else
78 llWhisper(channel,"open");
79 llSetRot(DestRotation); // set dest rotation
80 if(! debug)
81 llDie();
82 }
83
84
85 default
86 {
88 {
89 if(debug)
90 channel = 0;
91
93 llSetSitText("Enter");
94 llSitTarget( MYOFFSET, MYROT);
95 myName = llGetObjectName();
96 listener = llListen(channel,myName,NULL_KEY,"");
97 if(debug)
98 llSay(channel,"reset");
99 else
100 llRegionSay(channel,"reset");
101 Tell();
102 }
103
104 changed (integer what)
105 {
106 if(what & CHANGED_LINK)
107 {
108 if(debug) llOwnerSay("changed");
109 AvatarKey = llAvatarOnSitTarget();
110 if(AvatarKey != NULL_KEY)
111 {
112 if(debug) llOwnerSay("request perms");
114 }
115 }
116 else
117 {
119 }
120
121 }
122
123 listen(integer channel,string name, key id, string message)
124 {
125 if(id == llGetKey())
126 return;
127 if(message == "reset")
128 {
129 Tell();
130 return;
131 }
132 if(message == "open")
133 return;
134
135 if(debug) llOwnerSay("Heard:" + message);
136 if(id != llGetKey())
137 {
138 list params = llParseString2List(message,["|"],[""]);
139 DestPosition = (vector) llList2String(params,0);
140 DestRotation = (rotation) llList2String(params,1);
141 if(debug) llOwnerSay("Set Pos:" + (string) DestPosition + " rot:" + (string) DestRotation);
142 }
143
144 }
145
147 {
149 {
150 if(debug) llOwnerSay("perms granted");
151 Go();
152 }
153 }
154
156 {
158 }
159
160 }

Magic Door

moving prim

Category: Door
By : Ferd Frederix
Created: 2013-09-06 Edited: 2013-09-04
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 debug = 1;
3
4 integer channel = -44443; // listener from other prim
5 integer listener; // channel handle
6 string myName; // Name of this prim
7
8 vector OFFSET = <0,0,0.1>; // offset to the other door
9 rotation ROT = <0,0,0,1>; // rotation when we get there
10
11 vector MYOFFSET = <0,0,0.1>; // offset to the other door
12 rotation MYROT = <0,0,0,1>; // rotation when we get there
13
14 string animation ;
15
16 key AvatarKey; // key of who touched the door
17
18 Go()
19 {
20
21 if(debug) llOwnerSay("starting animation");
22 llStartAnimation(animation);
23 llSleep(3);
24 if(debug) llOwnerSay("starting movement to " + (string )OFFSET);
25 UpdateSitTarget(OFFSET,ROT);
26 if(debug) llOwnerSay("ending animation");
27 llSleep(3);
28 llStopAnimation(animation);
29 llUnSit(AvatarKey);
30
31 string location = (string) llGetPos() + "|" + (string) llGetRot();
32 llRegionSay(channel,location);
33
34 }
35
36
37 //Sets / Updates the sit target moving the avatar on it if necessary.
38 UpdateSitTarget(vector pos, rotation rot)
39 {
40 //Using this while the object is moving may give unpredictable results.
41 llSitTarget(pos, rot);//Set the sit target
42 key user = llAvatarOnSitTarget();
43 if(user)//true if there is a user seated on the sittarget, if so update their position
44 {
45 vector size = llGetAgentSize(user);
46 if(size)//This tests to make sure the user really exists.
47 {
48 //We need to make the position and rotation local to the current prim
49 rotation localrot = ZERO_ROTATION;
50 vector localpos = ZERO_VECTOR;
51 if(llGetLinkNumber() > 1)//only need the local rot if it's not the root.
52 {
53 localrot = llGetLocalRot();
54 localpos = llGetLocalPos();
55 }
56 pos.z += 0.4;
57 integer linkNum = llGetNumberOfPrims();
58 do{
59 if(user == llGetLinkKey( linkNum ))//just checking to make sure the index is valid.
60 {
62 [PRIM_POSITION, ((pos - (llRot2Up(rot) * size.z * 0.02638)) * localrot) + localpos,
63 PRIM_ROTATION, rot * localrot / llGetRootRotation()]);
64 jump end;//cheaper but a tad slower then return
65 }
66 }while( --linkNum );
67 }
68 else
69 {//It is rare that the sit target will bork but it does happen, this can help to fix it.
70 llUnSit(user);
71 }
72 }
73 @end;
74 } //Written by Strife Onizuka, size adjustment provided by Escort DeFarge
75
76
77
78
79 default
80 {
82 {
84 llSetSitText("Enter");
85 llSitTarget( MYOFFSET, MYROT);
86 myName = llGetObjectName();
87 listener = llListen(channel,myName,NULL_KEY,"");
88 string location = (string) llGetPos() + "|" + (string) llGetRot();
89 llRegionSay(channel,location);
90
91 }
92
93 changed (integer what)
94 {
95 if(what & CHANGED_LINK)
96 {
97 if(debug) llOwnerSay("changed");
99 {
100 if(debug) llOwnerSay("request perms");
101 AvatarKey = llAvatarOnSitTarget();
103 }
104 }
105 else
106 {
108 }
109
110 }
111
112 listen(integer channel,string name, key id, string message)
113 {
114 if(debug) llOwnerSay("Heard:" + message);
115 if(id != llGetKey())
116 {
117 list params = llParseString2List(message,["|"],[""]);
118 OFFSET = (vector) llList2String(params,0);
119 ROT = (rotation) llList2String(params,1);
120 if(debug) llOwnerSay("Set Pos:" + (string) OFFSET + " rot:" + (string) ROT);
121 }
122 }
123
125 {
127 {
128 if(debug) llOwnerSay("perms granted");
129 Go();
130 }
131 }
132
134 {
136 }
137
138 }

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