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
AntiDelay AntiDelay_Node  

AntiDelay_Node

Almost every function in Second Life has a delay associated with it. Ranging from 20 seconds to .2 seconds - delays can get on anyones' nerves. Even the most basic scripters know the easy way to get around this is to have a script and use llMessageLinked to tell it to do something. Below is a more advanced version of that code - that allows for one script to handle almost any type of function with a delay.

How To Use: Use llMessageLinked - the integer is -123, the string is the list of arguments seperated by "~~~", and the key is the name of the function.

Category: AntiDelay
By : Xaviar Czervik
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for AntiDelay_Node
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. AntiDelay_Node_1.lsl
Get file # 2. AntiDelay_Node_2.lsl
Get file # 3. AntiDelay_Node_3.lsl
Get file # 4. AntiDelay_Node_4.lsl
Get file # 5. AntiDelay_Node_5.lsl
1 default {
2 touch_start(integer total_number) {
3 string s = llGetOwner();
4 llMessageLinked(LINK_SET, -123, s + "~~~This is a dialog~~~With, Three, Options~~~0", "dialog");
5 }
6 }
7

AntiDelay_Node

Example

Category: AntiDelay
By : Xaviar Czervik
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

1 default {
2 touch_start(integer total_number) {
3 vector v = <128,128,300>;
4 integer i = 0;
5 float vecDist = llVecDist(llGetPos(), v);
6 vecDist /= 5;
7 vecDist += 1;
8 while(i < vecDist) {
9 llMessageLinked(LINK_SET, -123, (string)v, "setpos");
10 i++;
11 }
12 }
13 }

AntiDelay_Node

And now for the full and complete power of this code *drum roll*. Only 2 scripts are needed for the following code to work.

Category: AntiDelay
By : Xaviar Czervik
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

1 default {
2 touch_start(integer total_number) {
3 string s = llGetOwner();
4 llMessageLinked(LINK_SET, -123, s + "~~~This is a dialog~~~With, Three, Options~~~0", "dialog");
5 llMessageLinked(LINK_SET, -123, "youemail@theaddress.com~~~Subj~~~Body", "email");
6 llSleep(1);
7 llMessageLinked(LINK_SET, -123, s + "~~~This is a dialog~~~With, Three, Options~~~0", "dialog");
8 llSleep(1);
9 llMessageLinked(LINK_SET, -123, "youemail@theaddress.com~~~Subj~~~Body", "email");
10
11 }
12 }
13

AntiDelay_Node

The code to make it all work:


AntiDelay Node Manager:

Category: AntiDelay
By : Xaviar Czervik
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

1 list l = [];
2 list functions = ["email", "loadurl", "teleportagenthome", "remoteloadscriptpin", "remotedatareply", "giveinventorylist",
3 "setparcelmusicurl", "instantmessage", "preloadsound", "mapdestination", "dialog", "createlink", "setpos",
4 "setrot", "settexture", "rezobject"];
5 list delays = [20000, 10000, 5000, 3000, 3000, 2000, 2000, 1000, 1000, 1000, 1000, 1000, 200, 200, 200, 100];
6 integer count = 1;
7 integer time() {
8 string stamp = llGetTimestamp();
9 return (integer) llGetSubString(stamp, 11, 12) * 3600000 +
10 (integer) llGetSubString(stamp, 14, 15) * 60000 +
11 llRound((float)llGetSubString(stamp, 17, -2) * 1000000.0)/1000;
12 }
13 integer nextFreeScript() {
14 integer i = 0;
15 integer curTime = time();
16 while(i < llGetListLength(l)) {
17 if(llList2Integer(l, i) - curTime <= 0) {
18 return i;
19 }
20 ++i;
21 }
22 return -1;
23 }
24
25 default {
26 state_entry() {
27 llMessageLinked(LINK_SET, -112, "", "");
28 llSleep(1);
29 llMessageLinked(LINK_SET, -111, "", "");
30 }
31 link_message(integer send, integer i, string s, key k) {
32 if(i == -2) {
33 llMessageLinked(LINK_SET, (integer)s, (string)count, "");
34 ++count;
35 l += time();
37 }
38 }
39 timer() {
40 state run;
41 }
42 }
43
44 state run {
45 state_entry() {
46 }
47 link_message(integer send, integer i, string s, key k) {
48 if(i == -123) {
49 llOwnerSay("A");
50 integer d = llList2Integer(delays, llListFindList(functions, [(string)k]));
51 integer ii = nextFreeScript();
52 l = llListReplaceList(l, [time() + d], ii, ii);
53 llMessageLinked(LINK_SET, ii+1, s, k);
54 }
55 }
56 }

AntiDelay_Node

AntiDelay Node:

Category: AntiDelay
By : Xaviar Czervik
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

1
2 integer myId;
3 default {
4 link_message(integer send, integer i, string s, key k) {
5 if(i == myId && myId) {
6 myId = (integer)s;
7 state run;
8 }
9 if(i == -111) {
10 myId = (integer)llFrand(0x7FFFFFFF);
11 llSleep(llFrand(5));
12 llMessageLinked(LINK_SET, -2, (string)myId, "");
13 }
14 }
15 }
16
17 state run {
18 link_message(integer send, integer i, string s, key k) {
19 list params = llParseString2List(s, ["~~~"], []);
20 if(i == myId && myId) {
21 if(llToLower(k) == "email") {
22 llEmail(llList2String(params, 0),
23 llList2String(params, 1),
24 llList2String(params, 2));
25 }
26 if(llToLower(k) == "loadurl") {
27 llLoadURL((key)llList2String(params, 0),
28 llList2String(params, 1),
29 llList2String(params, 2));
30 }
31 if(llToLower(k) == "teleportagenthome") {
33 }
34 if(llToLower(k) == "remoteloadscriptpin") {
36 llList2String(params, 1),
37 (integer)llList2String(params, 2),
38 (integer)llList2String(params, 3),
39 (integer)llList2String(params, 4));
40 }
41 if(llToLower(k) == "remotedatareply") {
43 (key)llList2String(params, 1),
44 llList2String(params, 2),
45 (integer)llList2String(params, 3));
46 }
47 if(llToLower(k) == "giveinventorylist") {
49 llList2String(params, 1),
50 llCSV2List(llList2String(params, 2)));
51 }
52 if(llToLower(k) == "setparcelmusicurl") {
54 }
55 if(llToLower(k) == "instantmessage") {
57 llList2String(params, 1));
58 }
59 if(llToLower(k) == "preloadsound") {
60 llPreloadSound(llList2String(params, 0));
61 }
62 if(llToLower(k) == "mapdestination") {
64 (vector)llList2String(params, 1),
65 (vector)llList2String(params, 2));
66 }
67 if(llToLower(k) == "dialog") {
68 llDialog((key)llList2String(params, 0),
69 llList2String(params, 1),
70 llCSV2List(llList2String(params, 2)),
71 (integer)llList2String(params, 3));
72 }
73 if(llToLower(k) == "createlink") {
74 llCreateLink((key)llList2String(params, 0),
75 (integer)llList2String(params, 1));
76 }
77 if(llToLower(k) == "setpos") {
78 llSetPos((vector)llList2String(params, 0));
79 }
80 if(llToLower(k) == "setrot") {
81 llSetRot((rotation)llList2String(params, 0));
82 }
83 if(llToLower(k) == "settexture") {
84 llSetTexture(llList2String(params, 0),
85 (integer)llList2String(params, 1));
86 }
87 if(llToLower(k) == "rezobject") {
88 llRezObject(llList2String(params, 0),
89 (vector)llList2String(params, 1),
90 (vector)llList2String(params, 2),
91 (rotation)llList2String(params, 3),
92 (integer)llList2String(params, 4));
93 }
94 }
95 if(i == -112) {
97 }
98 }
99 }
100

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