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
HyperGate Hyperica Hypergate  

Hyperica Hypergate

Excellent Hypergate Script with Detection of destination and ossL command sets

Category: HyperGate
By : Laxton Consulting for Maria Korolov
Created: 2015-03-08 Edited: 2015-03-08
Worlds: OpenSim

the Zip file

Download all files for Hyperica Hypergate
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Hyperica Hypergate Script CC0 LL v2.0.lsl
1 //:Rev: 5.1
2
3
4 /////////////////////////////////////////////////////////////////////////////////
5 // Rev 5.0 by Laxton Consulting for Maria Korolov
6 // added/edited debug messages
7 // reduced default state to initialize
8 // changed CHANGED_REGION_START to CHANGED_REGION_RESTART
9 // changed FunctionPermitted to FunctionAvailable
10 // added FunctionPermitted list to check OSSL
11 // added code to set FunctionAvailable mode of operation
12 // added state Checking
13 // changed state Running
14 // implemented timer termination scheme
15 /////////////////////////////////////////////////////////////////////////////////
16 // rev 5.1 by Ferd Frederix
17 // Bool, and Integer cannot be compared in some worlds
18 // llListFindList compares lists, not list and string.
19
20 integer debug = FALSE; // set to TRUE for DEBUG messages
21
22 /////////////////////////////////////////////////////////////////////////////////
23 // Changing anything below this line will risk breaking the script
24
25 DEBUG (string msg) { if(debug) llOwnerSay(llGetScriptName() + ":" + msg);}
26
27 integer WhichCheckFunction;
28 integer NumberOfFunctionsToCheck;
29 list FunctionNames = [ "osTeleportAgent", "osKey2Name"];
30 list FunctionPermitted = []; // 0 = not permitted, 1 = permitted
31
32 integer isFunctionAvailable( string whichFunction )
33 {
34 integer index = llListFindList( FunctionNames, [whichFunction] );
35 if(index == -1) return 0;
36 return llList2Integer( FunctionPermitted, index );
37 }
38
39 integer Rev = 5;
40 key httpkey;
41 string body_retrieved;
42 key StatusQuery;
43 integer FontSize;
44
45 string SimName;
46 string SimAddress;
47 vector LandingPoint = <128.0, 128.0, 22.0>;
48 vector LookAt = <1.0,1.0,1.0>;
49
50 list LastFewAgents;
51
52 string FunctionName = "osTeleportAgent";
53 string FunctionAvailable = "No";
54 integer checked = 0;
55
56 SpecialEffect()
57 {
58 llPlaySound("d7a9a565-a013-2a69-797d-5332baa1a947", 1);
69 PSYS_SRC_ACCEL, <0.0,0.0,0.0>,
70 PSYS_PART_START_COLOR, <1, 1, 1>,
73 PSYS_PART_START_SCALE, <.3,.3,0>,
74 PSYS_PART_END_SCALE, <.5,.5,0>,
76 , 0
79 ]);
80 }
81
82 LoadDestination ()
83 {
84 SimName=llGetObjectName();
85 SimAddress=llGetObjectDesc();
86 FontSize = (integer) (llStringLength(SimName)*(-2.25)+60.5);
87 FontSize = ((integer) (FontSize >= 10 ) * FontSize ) + ((integer)(FontSize<10 ) * 10);
88 FontSize = ((integer) (FontSize <= 40 ) * FontSize ) + ((integer)(FontSize>40 ) * 40);
89 DEBUG ("Object Name is "+SimName + " with font size of " + (string) FontSize);
90 DEBUG ("Object Address is "+SimAddress);
91 StatusQuery = llRequestSimulatorData(SimAddress, DATA_SIM_STATUS);
92 string CommandList = "";
93 CommandList = osMovePen( CommandList, 5, 55 );
94 CommandList += "FontSize "+ (string) FontSize+";";
95 CommandList = osDrawText( CommandList, SimName );
96 osSetDynamicTextureDataBlendFace( "", "vector", CommandList, "width:256,height:256", FALSE, 2, 0, 255, 3 );
97 DEBUG("CommandList is "+CommandList);
98 }
99
100 PerformTeleport( key WhomToTeleport )
101 {
102 integer CurrentTime = llGetUnixTime();
103 integer AgentIndex = llListFindList( LastFewAgents, [ WhomToTeleport ] );
104 if(AgentIndex != -1)
105 {
106 integer PreviousTime = llList2Integer( LastFewAgents, AgentIndex+1 );
107 if(PreviousTime >= (CurrentTime - 30)) return;
108 LastFewAgents = llDeleteSubList( LastFewAgents, AgentIndex, AgentIndex+1);
109 }
110 LastFewAgents += [ WhomToTeleport, CurrentTime ];
111 if(FunctionAvailable == "Yes")
112 osTeleportAgent( WhomToTeleport, SimAddress, LandingPoint, LookAt );
113 else
114 llMapDestination(SimAddress, LandingPoint, LookAt);
115 }
116
117 default //initializes the gate
118 {
120 {
121 DEBUG("default state_entry");
122 LoadDestination(); // load destination in case we changed it on the gate and reset the script manually
124 state Checking;
125 }
126
127 changed(integer what)
128 {
129 if(what & CHANGED_REGION_RESTART)
130 {
131 DEBUG("detected region restart, resetting...");
132 llVolumeDetect(FALSE); // toggle bug fix in Opensim
135 }
136 }
137
138 on_rez(integer start_param)
139 {
140 LoadDestination(); // initial load may be empty fields
141 }
142 }
143
144 state Checking // checks to see whether we are able to use osTeleportAgent
145 {
147 {
148 NumberOfFunctionsToCheck = llGetListLength( FunctionNames );
149 WhichCheckFunction = -1;
150 llSetTimerEvent( 0.25 ); // runs one time for each OSSL function check in FunctionPermitted list
151 }
152
153 timer()
154 {
155 string s;
156 key key1;
157 if(++WhichCheckFunction == NumberOfFunctionsToCheck)
158 {
159 llSetTimerEvent( 0.0 ); // disable timer
160 state Running;
161 }
162 DEBUG( "Checking function " + llList2String( FunctionNames, WhichCheckFunction ));
163 if(WhichCheckFunction == 0) osTeleportAgent(key1,ZERO_VECTOR,ZERO_VECTOR);
164 else if(WhichCheckFunction == 1) s=osKey2Name(key1);
165 FunctionPermitted = llListReplaceList( FunctionPermitted, [ 1 ], WhichCheckFunction, WhichCheckFunction );
166 llSetTimerEvent( 0.25 ); // restarts timer to check next OSSL function in FunctionPermitted list
167 }
168 }
169
170 state Running
171 {
173 {
174 DEBUG("state Running");
175 string s = "These OSSL functions are available: ";
176 string t = "These OSSL functions are not available: ";
177 integer i = llGetListLength( FunctionNames );
178 while(i--)
179 if(llList2Integer( FunctionPermitted, i )) s += llList2String( FunctionNames, i ) + " ";
180 else t += llList2String( FunctionNames, i ) + " ";
181 DEBUG( s );
182 DEBUG( t );
183 if(isFunctionAvailable( "osTeleportAgent" )) FunctionAvailable="Yes"; // sets FunctionAvailable for mode of gate operation
184 else FunctionAvailable="No";
185 LoadDestination();
186 llSetTextureAnim(ANIM_ON | LOOP, 1, 4, 4, 0.0, 16, 5);
187 llSetText("", ZERO_VECTOR, 0);
188 }
189
190 dataserver(key queryId, string data) //turn gate black if destination is down
191 {
192 if(data=="up") llSetColor(<1.000, 1.000, 1.000>,1);
193 else llSetColor(<0.067, 0.067, 0.067>,1);
194 }
195
196 touch_start(integer number)
197 {
198 LoadDestination(); // load destination
199 }
200
201 collision(integer number)
202 {
203 SpecialEffect();
204 PerformTeleport( llDetectedKey( 0 ));
205 }
206 changed(integer what)
207 {
208 if(what & CHANGED_REGION_RESTART)
209 {
210 DEBUG("detected region restarted, resetting VolumeDetect");
211 llVolumeDetect(FALSE); // toggle bug fix in Opensim
214 }
215 }
216 }

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