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 Hypergates  

Hypergates

Hypergate script for Opensim
:LICENSE: CC-0
Maria Korolov's Hypergate script

Category: Hypergate
By : Maria Korolov
Created: 2015-01-15 Edited: 2016-06-16
Worlds: OpenSim

the Zip file

Download all files for Hypergates
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. HG Script.lsl
Get file # 2. Script Updater.lsl
Get file # 3. Script. Udater Server.lsl
1
2 integer Rev = 4;
3
4 key StatusQuery;
5 integer FontSize;
6
7 string SimName;
8 string SimAddress;
9 vector LandingPoint = <128.0, 128.0, 22.0>;
10 vector LookAt = <1.0,1.0,1.0>;
11
12 list LastFewAgents;
13
14 string FunctionName = "osTeleportAgent";
15 string FunctionPermitted = "No";
16 integer checked = 0;
17
18 SpecialEffect()
19 {
20 llPlaySound("d7a9a565-a013-2a69-797d-5332baa1a947", 1); // change this to match your sim sound
31 PSYS_SRC_ACCEL, <0.0,0.0,0.0>,
32 PSYS_PART_START_COLOR, <1, 1, 1>,
35 PSYS_PART_START_SCALE, <0.3,0.3,0>,
36 PSYS_PART_END_SCALE, <0.5,0.5,0>,
38 , 0
41 ]);
42 }
43
44 LoadDestination ()
45 {
46 list Description = llParseString2List(llGetObjectDesc(), [", "],[","]);
47 SimName = llList2String(Description,0);
48 FontSize = (integer) (llStringLength(SimName)*(-2.25)+60.5);
49 SimAddress = llList2String(Description,1);
50 StatusQuery = llRequestSimulatorData(SimAddress, DATA_SIM_STATUS);
51 string CommandList = "";
52 CommandList = osMovePen( CommandList, 5, 55 );
53 CommandList += "FontSize "+ (string) FontSize+";";
54 CommandList = osDrawText( CommandList, SimName );
55 osSetDynamicTextureDataBlendFace( "", "vector", CommandList, "width:256,height:256", FALSE, 2, 0, 255, 3 );
56
57 }
58
59 PerformTeleport( key WhomToTeleport )
60 {
61 integer CurrentTime = llGetUnixTime();
62 integer AgentIndex = llListFindList( LastFewAgents, [ WhomToTeleport ] );
63 if(AgentIndex != -1)
64 {
65 integer PreviousTime = llList2Integer( LastFewAgents, AgentIndex+1 );
66 if(PreviousTime >= (CurrentTime - 30)) return;
67 LastFewAgents = llDeleteSubList( LastFewAgents, AgentIndex, AgentIndex+1);
68 }
69 LastFewAgents += [ WhomToTeleport, CurrentTime ];
70 if(FunctionPermitted == "Yes")
71 osTeleportAgent( WhomToTeleport, SimAddress, LandingPoint, LookAt );
72 else
73 llMapDestination(SimAddress, LandingPoint, LookAt);
74 }
75
76 default
77 {
79 {
80 LoadDestination();
81 llVolumeDetect(FALSE); // toggle bug fix in Opensim
83 FunctionPermitted = "Yes";
84 }
85
86 changed(integer what)
87 {
88 if(what & CHANGED_REGION_START)
89 {
91 }
92 }
93
94 on_rez(integer start_param)
95 {
96 LoadDestination();
97 FunctionPermitted = "Yes";
98 }
99
100 }
101
102 state Running
103 {
105 {
106 llOwnerSay( "Results: "+ FunctionPermitted);
107 LoadDestination();
108 llSetTextureAnim(ANIM_ON | LOOP, 1, 4, 4, 0.0, 16, 5);
109 llSetText("", ZERO_VECTOR, 0);
110 }
111
112 dataserver(key queryId, string data) //turn gate black if destination is down
113 {
114 if(data=="up") llSetColor(<1.000, 1.000, 1.000>,1);
115 else llSetColor(<0.067, 0.067, 0.067>,1);
116 }
117
118 touch_start(integer number)
119 {
120 LoadDestination();
121 }
122
123 collision(integer number)
124 {
125 SpecialEffect();
126 PerformTeleport( llDetectedKey( 0 ));
127 }
128
129 changed(integer what)
130 {
131 if(what & CHANGED_REGION_START)
132 {
134 }
135 }
136 }

Hypergates

Remote prim updater for scripts. This registers the prim to accept scripts from a server in the same region.

Category: Hypergate
By : Maria Korolov
Created: 2015-01-15 Edited: 2016-06-16
Worlds: OpenSim

1
2 // when anything changes in the prims inventory, this sends the name and UUID to a central server.
3 // It enabled remote script loading from that central prim, estate-wide
4 // As a result, if you add any new scripts, they auto-get inserted into the database
5 // tunable
6
7 integer debug = FALSE; // chat a message
8 integer UNIQ = 1246; // the private channel unique to the owner of this prim
9
10 // Not tuneable
11 integer CHECKIN = 86400; // 86400 seconds = 1 day
12 integer comChannel ; // placeholder for llRegionSay
13 DEBUG (string msg) { if(debug) llOwnerSay(llGetScriptName() + ":" + msg);}
14 integer pin; // a random pin for security
15
16 update() {
17
19 integer i;
20 for (i = 0; i < j; i++)
21 {
23 DEBUG("Sending " + name);
24 llRegionSay(comChannel,name + "^" + (string) pin);
25 }
26 llOwnerSay("Script Updater ready");
27 llSetTimerEvent(CHECKIN); // Hourly check ins
28 }
29
30
31 default
32 {
34 {
35 pin = llCeil(llFrand(123456) + 654321);
36 comChannel = (((integer)("0x"+llGetSubString((string)llGetOwner(),-8,-1)) & 0x3FFFFFFF) ^ 0xBFFFFFFF ) + UNIQ; // 1234 is the private channel for this owner
38 update();
39
40 }
41 // in case we rez, our UUID changed, so we check in
42 on_rez(integer p) {
43 llResetScript(); }
44
45 // a new script may have been added
46 changed ( integer what)
47 {
48 if(what & CHANGED_INVENTORY ) {
49 update();
50 }
51 if(what & CHANGED_REGION_START ) {
53 }
54 }
55
56 timer()
57 {
58 update();
59 }
60
61 }

Hypergates

Central prim updater for scripts. Just drop a (non running) script in here and click the prim. Scripts are sent to the registered clients

Category: Hypergate
By : Maria Korolov
Created: 2015-01-15 Edited: 2016-06-16
Worlds: OpenSim

1
2 // Rev 1.1 on 2-13-2014 fixes timeout bugs, adds
3 //
4
5
6 integer debug = TRUE; // chat a message
7
8 // tunables
9 integer TITLE = TRUE; // show how many scripts can be updated in hover text
10 integer UNIQ = 1246; // the private channel unique to the owner of this prim - MUST MATCH in client and server
11 integer CHECKIN = 172860; // 86400 seconds = 1 day X 2 + 60. This is twice the client setting plus one minute to allow for a dropped packet and slop in LSLEditor
12
13 // globals
14 integer comChannel ; // we listen on this channel. It is unioque to this owner and a subchannel
15 integer MINUTE = 60; // seconds in a minute, seems inefficient, but debug is a lot faster this way!
16
17 DEBUG (string msg) { if(debug) llSay(0,llGetScriptName() + ":" + msg);}
18
19 // The list is a PIN to update, a timestamp, thre name of the script, the UUID of the prim it was found in
20 // This is a small searchable database whose primary key (uniq) is name + UUID
21 integer STRIDE = 4; // size of this list:
22 list lScripts; // +0 (integer) PIN - remote prims random PIN
23 // +1 (integer) time stamp last heard from
24 // +2 (string) name of script
25 // +3 (key) UUID
26
27 update()
28 {
29 integer toDo = llGetInventoryNumber(INVENTORY_SCRIPT); // how many scripts checked in?
30 integer PrimToDo = llGetListLength(lScripts);
31
32 llOwnerSay((string) (toDo -1) + " scripts in inventory to send");
33 // DEBUG(llDumpList2String(lScripts,","));
34
35 integer index;
36
37 // scan all scripts in our inventory, could be more than one needs updating.
38 for (index = 0; index < toDo; index++)
39 {
41
42
43 // check to see if the name of the script we just found in our inventory matches ourself. if so, skip it
44
45 if(name != llGetScriptName()) {
46 DEBUG( "Processing script " + name);
47 integer countAllScripts = llGetListLength(lScripts);
48
49 integer indexer;
50 integer counter;
51 // Scan over all scripts
52 for (indexer = 0; indexer < countAllScripts; indexer += STRIDE)
53 {
54 // check to see if the name of the script we just found in our inventory matches any item in the list
55 if(llList2String(lScripts,indexer + 2) == name) {
56
57 key targetUUID = llList2Key(lScripts,indexer + 3); // yup, the name matches, lets fetch the UUID
58 integer pin = llList2Integer(lScripts,indexer ); // get the pin
59 DEBUG("Sending " + name + " PIN:" + (string) pin + " UUID:" + (string) targetUUID);
60 llRemoteLoadScriptPin(targetUUID,name,pin, TRUE,0); // and send it set to run
61 counter++;
62 }
63 }
64 DEBUG("Updated " + (string) counter + " scripts named " + name);
65 }
66 }
67 llOwnerSay("Done!");
68
69 }
70
71 default
72 {
74 {
75 if(! TITLE) {
76 llSetText("",<1,1,1>,1.0);
77 }
78
79 // make a private chat channel
80 comChannel = (((integer)("0x"+llGetSubString((string)llGetOwner(),-8,-1)) & 0x3FFFFFFF) ^ 0xBFFFFFFF ) + UNIQ; // UNIQ is the private channel for this owner
81 llListen(comChannel,"","","");
82 llOwnerSay("Put non-running scripts into inventory and touch this to send them to remote prims.");
83 llSetTimerEvent(CHECKIN);
84 }
85
86 listen(integer channel, string name, key id, string msg)
87 {
88 list params = llParseString2List(msg,["^"],[]);
89 string message = llList2String(params,0);
90 integer pin = (integer) llList2String(params,1);
91
92 integer index;
93 integer len = llGetListLength(lScripts);
94 integer found = FALSE;
95
96 // CRU of CRUD process
97 // try to find a script in that prim previously recorded. If found update
98 for ( index = 0; index < len; index += STRIDE) {
99 // primary key is composite of UUID of prim and script name
100 if(llList2String(lScripts,index+2) == message && llList2Key(lScripts,index+3) == id) {
101 // found a prim and script that has already checked in.
102 DEBUG("Located script " + llList2String(lScripts,index+2));
103 lScripts = llListReplaceList([pin,llGetUnixTime(),message,pin],lScripts,index,index+3);
104 found = TRUE;
105 index = len; // skip to end
106 }
107 }
108
109 if(!found) {
110
111 DEBUG("Adding script " + message);
112 lScripts += pin; // the remote prim pin
113 lScripts += llGetUnixTime(); // time stamp it
114 lScripts += message; // remote prim name
115 lScripts += id; // remote prim UUID
116 }
117 }
118
119 touch_start( integer what)
120 {
121 if(llDetectedKey(0) == llGetOwner()) {
122 update();
123 }
124 }
125
126 // D of CRUD process
127 // scan for missing checked-in prims and clean up the list
128 timer()
129 {
130 integer len = llGetListLength(lScripts);
131
132 while(len > 0)
133 {
134 // look for late checkins, which means a script was stopped or a prim removed.
135 // Every day or two plus a minute for message delays is good to prevent RAM from filling up,
136 /// and still allows allows one missed message
137
138 integer timeago = llGetUnixTime() - llList2Integer(lScripts,len-STRIDE);
139 DEBUG("Timeago " + (string) timeago);
140
141 if( timeago > (CHECKIN*2 + MINUTE))
142 {
143 DEBUG("Have not heard from script named " + llList2String(lScripts,len-2) + ": Script named " + llKey2Name(llList2Key(lScripts,len-1)) );
144 lScripts = llDeleteSubList(lScripts,len-STRIDE,len);
145 len = llGetListLength(lScripts);
146 } else
147 len -= 3;
148 }
149
150 len = llGetListLength(lScripts);
151 if(TITLE) {
152 llSetText((string) (len/3) + " scripts",<1,1,1>,1.0);
153 }
154 }
155
156
157
158
159
160 }

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