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
Fire Realfire by Rene  

Realfire by Rene

Link control (secondary switch) for RealFire

Category: Fire
By : Rene10957 Resident
Created: 2015-06-11 Edited: 2015-06-14
Worlds: Second Life

the Zip file

Download all files for Realfire by Rene
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. license.txt
Get file # 2. readme.txt
Get file # 3. link_control.lsl
Get file # 4. network_control.lsl
Get file # 5. network_control_region.lsl
Get file # 6. network_receiver.lsl
Get file # 7. network_receiver_region.lsl
Get file # 8. remote_control.lsl
Get file # 9. remote_receiver.lsl
Get file # 10. smoke_control.lsl
Get file # 11. nightfire.lsl
Get file # 12. proximity.lsl
Get file # 13. [39152 bytes] glow_large.png
Get file # 14. [29581 bytes] glow_medium.png
Get file # 15. [63245 bytes] pixie_large.png
Get file # 16. [41129 bytes] pixie_medium.png
Get file # 17. color_converter.lsl
Get file # 18. 4211__dobroide__fire-crackling.wav
Get file # 19. config.txt
Get file # 20. fire.lsl
Get file # 21. smoke.lsl
1 //:LICENSE: CC0 (Public Domain). To the extent possible under law, Rene10957 has waived all copyright and related or neighboring rights.For more information, see http://creativecommons.org/publicdomain/zero/1.0/.
2
3 // Link control (secondary switch) for RealFire
4 //
5 //
6 // Drop this in any prim (within the same linkset) you want to use as an on/off/menu switch
7 // Note: only useful if you want to use a different prim as a switch (other than the fire prim)
8
9 string title = "Link Control"; // title
10 string version = "1.1"; // version
11 integer silent = TRUE; // silent startup
12
13 // Constants
14
15 integer msgNumber = 10959; // number part of link message
16
17 default
18 {
20 {
21 if(!silent) llWhisper(0, title + " " + version + " ready");
22 }
23
24 on_rez(integer start_param)
25 {
27 }
28
29 touch_start(integer total_number)
30 {
32 }
33
34 touch_end(integer total_number)
35 {
36 key user = llDetectedKey(0);
37
38 if(llGetTime() > 1.0) {
39 llMessageLinked(LINK_ALL_OTHERS, msgNumber, "menu", user);
40 }
41 else {
42 llMessageLinked(LINK_ALL_OTHERS, msgNumber, "switch", user);
43 }
44 }
45 }

Realfire by Rene

Network control for RealFire

Category: Fire
By : Rene10957 Resident
Created: 2015-06-11 Edited: 2015-06-14
Worlds: Second Life

1 //:LICENSE: CC0 (Public Domain). To the extent possible under law, Rene10957 has waived all copyright and related or neighboring rights.For more information, see http://creativecommons.org/publicdomain/zero/1.0/.
2 //
3 //
4 // Drop this in any prim you want to use as a control panel
5
6 string title = "Network Control"; // title
7 string version = "2.2.2"; // version
8 integer linkSet = TRUE; // LINKSET mode
9 integer silent = TRUE; // silent startup
10
11 // Constants
12
13 float cDialogTime = 120.0; // dialog timeout = 2 minutes
14 float cReplyTime = 1.0; // reply timeout = 1 second
15 integer remoteChannel = -975101; // remote channel (send)
16 integer replyChannel = -975106; // reply channel (receive)
17 string separator = ";;"; // separator for link or region messages
18
19 // Variables
20
21 float time; // timer interval for multiple timers
22 float vReplyTime; // variable timeout for node discovery, ranging from 1 to 2 sec.
23 integer dialogChannel; // dialog channel
24 integer dialogHandle; // handle for dialog listener
25 integer replyHandle; // handle for reply listener
26 key owner; // object owner
27 key user; // key of last avatar to touch object
28 list networkNodes; // strided list of network nodes (object key, object name)
29 list menuButtons; // menu buttons (object names)
30
31 // Functions
32
33 list orderButtons(list buttons)
34 {
35 return llList2List(buttons, -3, -1) + llList2List(buttons, -6, -4) + llList2List(buttons, -9, -7);
36 }
37
38 float setTimer(float sec)
39 {
40 llSetTimerEvent(0.0);
41 llSetTimerEvent(sec);
42 return sec;
43 }
44
45 discoverNodes(key id)
46 {
47 llWhisper(0, "Discovering network nodes...");
48 networkNodes = [];
49 llListenRemove(replyHandle);
50 replyHandle = llListen(replyChannel, "", "", "");
51 float pctlag = 100.0 * (1.0 - llGetRegionTimeDilation()); // try to work around time dilation
52 vReplyTime = cReplyTime + cReplyTime / 100.0 * pctlag; // (more lag = longer timeout)
53 time = setTimer(vReplyTime);
54 if(linkSet) llMessageLinked(LINK_ALL_OTHERS, remoteChannel, "PING", llGetKey());
55 else llRegionSay(remoteChannel, "PING");
56 }
57
58 menuDialog (key id)
59 {
60 dialogChannel = (integer)(llFrand(-1000000000.0) - 1000000000.0);
61 llListenRemove(dialogHandle);
62 dialogHandle = llListen(dialogChannel, "", "", "");
63 time = setTimer(cDialogTime);
64 llDialog(id, title + " " + version, menuButtons, dialogChannel);
65 }
66
67 default
68 {
70 {
71 owner = llGetOwner();
72 if(linkSet) version += "-LINKSET";
73 else version += "-REGION";
74 if(!silent) llWhisper(0, title + " " + version + " ready");
75 }
76
77 on_rez(integer start_param)
78 {
80 }
81
82 touch_start(integer total_number)
83 {
84 user = llDetectedKey(0);
85 if(llGetListLength(networkNodes) == 0) discoverNodes(user);
86 else menuDialog(user);
87 }
88
89 listen(integer channel, string name, key id, string msg)
90 {
91 integer length = llGetListLength(networkNodes) / 2;
92
93 if(channel == replyChannel) {
94 if(llGetOwnerKey(id) != owner) return;
95 if(msg != "DATA") return;
96 if(length > 8) return;
97 string shortName = llGetSubString(name, 0, 23);
98 networkNodes += [id] + [shortName];
99 }
100 else if(channel == dialogChannel) {
102 llListenRemove(dialogHandle);
103 integer i;
104 integer index;
105 key target;
106 list msgList;
107 string msgData;
108 if(msg == "On") {
109 for (i = 0; i < length; ++i) {
110 target = llList2Key(networkNodes, i * 2);
111 msgList = [target, "on", id]; // id = user who opened the dialog
112 msgData = llDumpList2String(msgList, separator);
113 if(linkSet) llMessageLinked(LINK_ALL_OTHERS, remoteChannel, msgData, "");
114 else llRegionSayTo(target, remoteChannel, msgData);
115 }
116 menuDialog(id);
117 }
118 else if(msg == "Off") {
119 for (i = 0; i < length; ++i) {
120 target = llList2Key(networkNodes, i * 2);
121 msgList = [target, "off", id]; // id = user who opened the dialog
122 msgData = llDumpList2String(msgList, separator);
123 if(linkSet) llMessageLinked(LINK_ALL_OTHERS, remoteChannel, msgData, "");
124 else llRegionSayTo(target, remoteChannel, msgData);
125 }
126 menuDialog(id);
127 }
128 else if(msg == "Discover") {
129 discoverNodes(id);
130 }
131 else {
132 index = llListFindList(networkNodes, [msg]);
133 if(index > -1) {
134 target = llList2Key(networkNodes, index - 1);
135 msgList = [target, "menu", id]; // id = user who opened the dialog
136 msgData = llDumpList2String(msgList, separator);
137 if(linkSet) llMessageLinked(LINK_ALL_OTHERS, remoteChannel, msgData, "");
138 else llRegionSayTo(target, remoteChannel, msgData);
139 }
140 else {
141 llInstantMessage(id, "Unexpected error during object key lookup");
142 menuDialog(id);
143 }
144 }
145 }
146 }
147
148 timer()
149 {
151 if(time == cDialogTime) { // dialog timeout
152 llListenRemove(dialogHandle);
153 }
154 else if(time == vReplyTime) { // remote timeout (variable!)
155 integer length = llGetListLength(networkNodes) / 2;
156 if(length == 1) llWhisper(0, "Node discovery completed (" + (string)length + " node)");
157 else llWhisper(0, "Node discovery completed (" + (string)length + " nodes)");
158 llListenRemove(replyHandle);
159 if(length > 0) {
160 menuButtons = llList2ListStrided(networkNodes, 1, -1, 2);
161 menuButtons = llListSort(menuButtons, 1, TRUE); // sort ascending
162 menuButtons = orderButtons(menuButtons); // reverse row order
163 menuButtons = ["On", "Off", "Discover"] + menuButtons;
164 if(user) menuDialog(user);
165 }
166 }
167 }
168 }

Realfire by Rene

Network control for RealFire

Category: Fire
By : Rene10957 Resident
Created: 2015-06-11 Edited: 2015-06-14
Worlds: Second Life

1 //:LICENSE: CC0 (Public Domain). To the extent possible under law, Rene10957 has waived all copyright and related or neighboring rights.For more information, see http://creativecommons.org/publicdomain/zero/1.0/.
2 //
3 //// Drop this in any prim you want to use as a control panel
4
5 string title = "Network Control"; // title
6 string version = "2.2.2"; // version
7 integer linkSet = FALSE; // REGION mode
8 integer silent = TRUE; // silent startup
9
10 // Constants
11
12 float cDialogTime = 120.0; // dialog timeout = 2 minutes
13 float cReplyTime = 1.0; // reply timeout = 1 second
14 integer remoteChannel = -975101; // remote channel (send)
15 integer replyChannel = -975106; // reply channel (receive)
16 string separator = ";;"; // separator for link or region messages
17
18 // Variables
19
20 float time; // timer interval for multiple timers
21 float vReplyTime; // variable timeout for node discovery, ranging from 1 to 2 sec.
22 integer dialogChannel; // dialog channel
23 integer dialogHandle; // handle for dialog listener
24 integer replyHandle; // handle for reply listener
25 key owner; // object owner
26 key user; // key of last avatar to touch object
27 list networkNodes; // strided list of network nodes (object key, object name)
28 list menuButtons; // menu buttons (object names)
29
30 // Functions
31
32 list orderButtons(list buttons)
33 {
34 return llList2List(buttons, -3, -1) + llList2List(buttons, -6, -4) + llList2List(buttons, -9, -7);
35 }
36
37 float setTimer(float sec)
38 {
39 llSetTimerEvent(0.0);
40 llSetTimerEvent(sec);
41 return sec;
42 }
43
44 discoverNodes(key id)
45 {
46 llWhisper(0, "Discovering network nodes...");
47 networkNodes = [];
48 llListenRemove(replyHandle);
49 replyHandle = llListen(replyChannel, "", "", "");
50 float pctlag = 100.0 * (1.0 - llGetRegionTimeDilation()); // try to work around time dilation
51 vReplyTime = cReplyTime + cReplyTime / 100.0 * pctlag; // (more lag = longer timeout)
52 time = setTimer(vReplyTime);
53 if(linkSet) llMessageLinked(LINK_ALL_OTHERS, remoteChannel, "PING", llGetKey());
54 else llRegionSay(remoteChannel, "PING");
55 }
56
57 menuDialog (key id)
58 {
59 dialogChannel = (integer)(llFrand(-1000000000.0) - 1000000000.0);
60 llListenRemove(dialogHandle);
61 dialogHandle = llListen(dialogChannel, "", "", "");
62 time = setTimer(cDialogTime);
63 llDialog(id, title + " " + version, menuButtons, dialogChannel);
64 }
65
66 default
67 {
69 {
70 owner = llGetOwner();
71 if(linkSet) version += "-LINKSET";
72 else version += "-REGION";
73 if(!silent) llWhisper(0, title + " " + version + " ready");
74 }
75
76 on_rez(integer start_param)
77 {
79 }
80
81 touch_start(integer total_number)
82 {
83 user = llDetectedKey(0);
84 if(llGetListLength(networkNodes) == 0) discoverNodes(user);
85 else menuDialog(user);
86 }
87
88 listen(integer channel, string name, key id, string msg)
89 {
90 integer length = llGetListLength(networkNodes) / 2;
91
92 if(channel == replyChannel) {
93 if(llGetOwnerKey(id) != owner) return;
94 if(msg != "DATA") return;
95 if(length > 8) return;
96 string shortName = llGetSubString(name, 0, 23);
97 networkNodes += [id] + [shortName];
98 }
99 else if(channel == dialogChannel) {
101 llListenRemove(dialogHandle);
102 integer i;
103 integer index;
104 key target;
105 list msgList;
106 string msgData;
107 if(msg == "On") {
108 for (i = 0; i < length; ++i) {
109 target = llList2Key(networkNodes, i * 2);
110 msgList = [target, "on", id]; // id = user who opened the dialog
111 msgData = llDumpList2String(msgList, separator);
112 if(linkSet) llMessageLinked(LINK_ALL_OTHERS, remoteChannel, msgData, "");
113 else llRegionSayTo(target, remoteChannel, msgData);
114 }
115 menuDialog(id);
116 }
117 else if(msg == "Off") {
118 for (i = 0; i < length; ++i) {
119 target = llList2Key(networkNodes, i * 2);
120 msgList = [target, "off", id]; // id = user who opened the dialog
121 msgData = llDumpList2String(msgList, separator);
122 if(linkSet) llMessageLinked(LINK_ALL_OTHERS, remoteChannel, msgData, "");
123 else llRegionSayTo(target, remoteChannel, msgData);
124 }
125 menuDialog(id);
126 }
127 else if(msg == "Discover") {
128 discoverNodes(id);
129 }
130 else {
131 index = llListFindList(networkNodes, [msg]);
132 if(index > -1) {
133 target = llList2Key(networkNodes, index - 1);
134 msgList = [target, "menu", id]; // id = user who opened the dialog
135 msgData = llDumpList2String(msgList, separator);
136 if(linkSet) llMessageLinked(LINK_ALL_OTHERS, remoteChannel, msgData, "");
137 else llRegionSayTo(target, remoteChannel, msgData);
138 }
139 else {
140 llInstantMessage(id, "Unexpected error during object key lookup");
141 menuDialog(id);
142 }
143 }
144 }
145 }
146
147 timer()
148 {
150 if(time == cDialogTime) { // dialog timeout
151 llListenRemove(dialogHandle);
152 }
153 else if(time == vReplyTime) { // remote timeout (variable!)
154 integer length = llGetListLength(networkNodes) / 2;
155 if(length == 1) llWhisper(0, "Node discovery completed (" + (string)length + " node)");
156 else llWhisper(0, "Node discovery completed (" + (string)length + " nodes)");
157 llListenRemove(replyHandle);
158 if(length > 0) {
159 menuButtons = llList2ListStrided(networkNodes, 1, -1, 2);
160 menuButtons = llListSort(menuButtons, 1, TRUE); // sort ascending
161 menuButtons = orderButtons(menuButtons); // reverse row order
162 menuButtons = ["On", "Off", "Discover"] + menuButtons;
163 if(user) menuDialog(user);
164 }
165 }
166 }
167 }

Realfire by Rene

Network receiver for RealFire

Category: Fire
By : Rene10957 Resident
Created: 2015-06-11 Edited: 2015-06-14
Worlds: Second Life

1 //:LICENSE: CC0 (Public Domain). To the extent possible under law, Rene10957 has waived all copyright and related or neighboring rights.For more information, see http://creativecommons.org/publicdomain/zero/1.0/.
2 // Drop this into the same prim where the FIRE SCRIPT is located
3 // Note: only useful if you are also using the network control script
4
5 string title = "Network Receiver"; // title
6 string version = "2.2.1"; // version
7 integer linkSet = TRUE; // LINKSET mode
8 integer silent = TRUE ; // silent startup
9
10 // Constants
11
12 integer remoteChannel = -975101; // remote channel
13 integer replyChannel = -975106; // reply channel
14 integer msgNumber = 10959; // number part of link message
15 string separator = ";;"; // separator for link or region messages
16
17 // Variables
18
19 key owner; // object owner
20
21 default
22 {
24 {
25 owner = llGetOwner();
26 if(linkSet) {
27 version += "-LINKSET";
28 }
29 else {
30 version += "-REGION";
31 llListen(remoteChannel, "", "", "");
32 }
33 if(!silent) llWhisper(0, title + " " + version + " ready");
34 }
35
36 on_rez(integer start_param)
37 {
39 }
40
41 link_message(integer sender_number, integer number, string msg, key id)
42 {
43 if(number != remoteChannel) return;
44 if(msg == "PING") {
45 llRegionSayTo(id, replyChannel, "DATA");
46 return;
47 }
48 list msgList = llParseString2List(msg, [separator], []);
49 key target = (key)llList2String(msgList, 0);
50 string command = llList2String(msgList, 1);
51 key user = (key)llList2String(msgList, 2);
52 if(target == llGetKey()) llMessageLinked(LINK_THIS, msgNumber, command, user);
53 }
54
55 listen(integer channel, string name, key id, string msg)
56 {
57 if(channel != remoteChannel) return;
58 if(llGetOwnerKey(id) != owner) return;
59 if(msg == "PING") {
60 llRegionSayTo(id, replyChannel, "DATA");
61 return;
62 }
63 list msgList = llParseString2List(msg, [separator], []);
64 string command = llList2String(msgList, 1);
65 key user = (key)llList2String(msgList, 2);
66 llMessageLinked(LINK_THIS, msgNumber, command, user);
67 }
68 }

Realfire by Rene

Network receiver for RealFire

Category: Fire
By : Rene10957 Resident
Created: 2015-06-11 Edited: 2015-06-14
Worlds: Second Life

1 //:LICENSE: CC0 (Public Domain). To the extent possible under law, Rene10957 has waived all copyright and related or neighboring rights.For more information, see http://creativecommons.org/publicdomain/zero/1.0/.
2 //
3 // Network receiver for RealFire
4 // Drop this into the same prim where the FIRE SCRIPT is located
5 // Note: only useful if you are also using the network control script
6
7 string title = "Network Receiver"; // title
8 string version = "2.2.1"; // version
9 integer linkSet = FALSE; // REGION mode
10 integer silent = TRUE; // silent startup
11
12 // Constants
13
14 integer remoteChannel = -975101; // remote channel
15 integer replyChannel = -975106; // reply channel
16 integer msgNumber = 10959; // number part of link message
17 string separator = ";;"; // separator for link or region messages
18
19 // Variables
20
21 key owner; // object owner
22
23 default
24 {
26 {
27 owner = llGetOwner();
28 if(linkSet) {
29 version += "-LINKSET";
30 }
31 else {
32 version += "-REGION";
33 llListen(remoteChannel, "", "", "");
34 }
35 if(!silent) llWhisper(0, title + " " + version + " ready");
36 }
37
38 on_rez(integer start_param)
39 {
41 }
42
43 link_message(integer sender_number, integer number, string msg, key id)
44 {
45 if(number != remoteChannel) return;
46 if(msg == "PING") {
47 llRegionSayTo(id, replyChannel, "DATA");
48 return;
49 }
50 list msgList = llParseString2List(msg, [separator], []);
51 key target = (key)llList2String(msgList, 0);
52 string command = llList2String(msgList, 1);
53 key user = (key)llList2String(msgList, 2);
54 if(target == llGetKey()) llMessageLinked(LINK_THIS, msgNumber, command, user);
55 }
56
57 listen(integer channel, string name, key id, string msg)
58 {
59 if(channel != remoteChannel) return;
60 if(llGetOwnerKey(id) != owner) return;
61 if(msg == "PING") {
62 llRegionSayTo(id, replyChannel, "DATA");
63 return;
64 }
65 list msgList = llParseString2List(msg, [separator], []);
66 string command = llList2String(msgList, 1);
67 key user = (key)llList2String(msgList, 2);
68 llMessageLinked(LINK_THIS, msgNumber, command, user);
69 }
70 }

Realfire by Rene

Remote control (secondary switch) for RealFire

Category: Fire
By : Rene10957 Resident
Created: 2015-06-11 Edited: 2015-06-14
Worlds: Second Life

1 //:LICENSE: CC0 (Public Domain). To the extent possible under law, Rene10957 has waived all copyright and related or neighboring rights.For more information, see http://creativecommons.org/publicdomain/zero/1.0/.
2
3 // Remote control (secondary switch) for RealFire
4 //
5 // Drop this in an external prim you want to use as an extra on/off/menu switch
6 // Note: only useful if you need an external switch for a single fire
7 //
8 // A switch can be bound to a fire by entering the same word in the description of both prims
9 // Alternatively, you can use the network switch to control up to 9 fires
10
11 string title = "Remote Control"; // title
12 string version = "1.1"; // version
13 integer silent = TRUE; // silent startup
14
15 // Constants
16
17 integer remoteChannel = -975102; // remote channel
18 string separator = ";;"; // separator for region messages
19
20 // Functions
21
22 string getGroup()
23 {
25 if(llToLower(str) == "(no description)" || str == "") str = "Default";
26 return str;
27 }
28
29 default
30 {
32 {
33 if(!silent) llWhisper(0, title + " " + version + " ready");
34 }
35
36 on_rez(integer start_param)
37 {
39 }
40
41 touch_start(integer total_number)
42 {
44 }
45
46 touch_end(integer total_number)
47 {
48 key user = llDetectedKey(0);
49 string command;
50
51 if(llGetTime() > 1.0) command = "menu";
52 else command = "switch";
53
54 list msgList = [getGroup(), command, user];
55 string msgData = llDumpList2String(msgList, separator);
56 llRegionSay(remoteChannel, msgData);
57 }
58 }

Realfire by Rene

Remote receiver for RealFire

Category: Fire
By : Rene10957 Resident
Created: 2015-06-11 Edited: 2015-06-14
Worlds: Second Life

1 //:LICENSE: CC0 (Public Domain). To the extent possible under law, Rene10957 has waived all copyright and related or neighboring rights.For more information, see http://creativecommons.org/publicdomain/zero/1.0/.
2
3 // Remote receiver for RealFire
4 //
5
6 // Drop this into the same prim where the FIRE SCRIPT is located
7 // Note: only useful if you are also using the remote control script
8
9 string title = "Remote Receiver"; // title
10 string version = "1.2"; // version
11 integer silent = TRUE; // silent startup
12
13 // Constants
14
15 integer remoteChannel = -975102; // remote channel
16 integer msgNumber = 10959; // number part of link message
17 string separator = ";;"; // separator for region messages
18
19 // Functions
20
21 string getGroup()
22 {
24 if(llToLower(str) == "(no description)" || str == "") str = "Default";
25 return str;
26 }
27
28 default
29 {
31 {
32 llListen(remoteChannel, "", "", "");
33 if(!silent) llWhisper(0, title + " " + version + " ready");
34 }
35
36 on_rez(integer start_param)
37 {
39 }
40
41 listen(integer channel, string name, key id, string msg)
42 {
43 if(channel != remoteChannel) return;
44
45 list msgList = llParseString2List(msg, [separator], []);
46 string group = llList2String(msgList, 0);
47 string command = llList2String(msgList, 1);
48 key user = (key)llList2String(msgList, 2);
49
50 if(group == getGroup() || group == "Default" || getGroup() == "Default") {
51 llMessageLinked(LINK_THIS, msgNumber, command, user);
52 }
53 }
54 }

Realfire by Rene

RGB to LSL color conversion

Category: Fire
By : Rene10957 Resident
Created: 2015-06-11 Edited: 2015-06-14
Worlds: Second Life

1 //:LICENSE: CC0 (Public Domain). To the extent possible under law, Rene10957 has waived all copyright and related or neighboring rights.For more information, see http://creativecommons.org/publicdomain/zero/1.0/.
2 // Smoke control (smoke without fire) for RealFire
3 //
4 // Author: Rene10957 Resident
5 // Date: 02-02-2014
6 //
7 // Use together with smoke script and drop in the same prim
8 // No other scripts are needed
9
10 string title = "Smoke Control"; // title
11 string version = "1.1"; // version
12 integer silent = TRUE; // silent startup
13
14 // Constants
15
16 integer smokeChannel = -15790; // smoke channel
17 integer on = FALSE; // smoke on/off
18
19 // Functions
20
21 toggleSmoke()
22 {
23 if(on) sendMessage(0); else sendMessage(100);
24 on = !on;
25 }
26
27 sendMessage(integer number)
28 {
29 llMessageLinked(LINK_THIS, smokeChannel, (string)number, "");
30 }
31
32 default
33 {
35 {
36 if(!silent) llWhisper(0, title + " " + version + " ready");
37 }
38
39 on_rez(integer start_param)
40 {
42 }
43
44 touch_start(integer total_number)
45 {
46 toggleSmoke();
47 }
48 }

Realfire by Rene

A simple example script for creating your own plugin

Category: Fire
By : Rene10957 Resident
Created: 2015-06-11 Edited: 2015-06-14
Worlds: Second Life

1 //:LICENSE: CC0 (Public Domain). To the extent possible under law, Rene10957 has waived all copyright and related or neighboring rights.For more information, see http://creativecommons.org/publicdomain/zero/1.0/.
2 // Night fire plugin for RealFire
3 // A simple example script for creating your own plugin
4 //
5 // Automatically switches on at sunset and off at sunrise
6
7 ///////////////////////////////////////////////////////////////////////////////
8 // HOW TO USE: drop this into the same prim where the FIRE SCRIPT is located //
9 ///////////////////////////////////////////////////////////////////////////////
10
11 key owner; // object owner
12 integer number = 10959; // number part of link message
13
14 default
15 {
17 {
18 owner = llGetOwner();
19 llSetTimerEvent(300);
20 }
21
22 on_rez(integer start_param)
23 {
25 }
26
27 timer()
28 {
30 if(sun.z < 0) llMessageLinked(LINK_THIS, number, "on", owner);
31 else llMessageLinked(LINK_THIS, number, "off", owner);
32 }
33 }

Realfire by Rene

Proximity plugin for RealFire

Category: Fire
By : Rene10957 Resident
Created: 2015-06-11 Edited: 2015-06-14
Worlds: Second Life

1 //:LICENSE: CC0 (Public Domain). To the extent possible under law, Rene10957 has waived all copyright and related or neighboring rights.For more information, see http://creativecommons.org/publicdomain/zero/1.0/.
2
3 // Proximity plugin for RealFire
4 // A simple example script for creating your own plugin
5 //
6 // Automatically switches on when an avatar comes within 10 meters
7 // Automatically switches off after one minute when no avatars are in range
8
9 ///////////////////////////////////////////////////////////////////////////////
10 // HOW TO USE: drop this into the same prim where the FIRE SCRIPT is located //
11 ///////////////////////////////////////////////////////////////////////////////
12
13 key owner; // object owner
14 integer number = 10959; // number part of link message
15 float range = 10.0; // scan range in meters
16 float rate = 10.0; // scan rate in seconds
17
18 default
19 {
21 {
22 owner = llGetOwner();
23 llSensorRepeat("", "", AGENT_BY_USERNAME, range, PI, rate);
24 }
25
26 on_rez(integer start_param)
27 {
29 }
30
31 sensor(integer total_number)
32 {
33 rate = 60.0;
34 llMessageLinked(LINK_THIS, number, "on", owner);
36 llSensorRepeat("", "", AGENT_BY_USERNAME, range, PI, rate);
37 }
38
39 no_sensor()
40 {
41 rate = 10.0;
42 llMessageLinked(LINK_THIS, number, "off", owner);
44 llSensorRepeat("", "", AGENT_BY_USERNAME, range, PI, rate);
45 }
46 }

Realfire by Rene

Configuration notecard for RealFire

Category: Fire
By : Rene10957 Resident
Created: 2015-06-11 Edited: 2015-06-14
Worlds: Second Life

1 //:LICENSE: CC0 (Public Domain). To the extent possible under law, Rene10957 has waived all copyright and related or neighboring rights.For more information, see http://creativecommons.org/publicdomain/zero/1.0/.
2
3 # Configuration notecard for RealFire
4 #
5 # Date: 31-05-2015
6 # Version: 3.0.1
7
8 verbose = YES # show more/less info during startup
9 switchAccess = PUBLIC # access level for switch (PUBLIC, GROUP, OWNER, GROUP+OWNER)
10 menuAccess = PUBLIC # access level for menu (PUBLIC, GROUP, OWNER, GROUP+OWNER)
11 burnDown = NO # YES = burn down, NO = burn continuously
12 loop = NO # YES = restart after burning down
13 burnTime = 300 # time to burn before starting to die, in seconds
14 dieTime = 300 # time it takes to die, in seconds
15 changeLight = YES # YES = change light with fire, NO = remain at current intensity/radius
16 changeSmoke = YES # YES = change smoke with fire, NO = remain at 100%
17 changeVolume = YES # YES = change volume with fire, NO = remain at current volume
18 singleFire = YES # YES = single fire, NO = multiple fires
19
20 # Menu defaults
21
22 size = 25 # fire size percentage
23 topColor = < 100, 0, 0 > # top color percentage (red, green, blue)
24 bottomColor = < 100, 100, 0 > # bottom color percentage (red, green, blue)
25 volume = 100 # sound volume percentage
26 smoke = YES # smoke or no smoke
27 sound = YES # sound or no sound
28
29 # Light properties
30
31 intensity = 100 # light intensity percentage
32 radius = 50 # light radius percentage
33 falloff = 40 # light falloff percentage
34
35 # Link messages: in
36
37 msgNumber = 10959 # number part of incoming link messages
38 msgSwitch = switch # string part of incoming link message: switch (on/off)
39 msgOn = on # string part of incoming link message: switch on
40 msgOff = off # string part of incoming link message: switch off
41 msgMenu = menu # string part of incoming link message: show menu
42
43 # Link messages: out
44
45 extButton = # "Close" replaced by button text (sends link message)
46 extNumber = 10960 # number part of outgoing link message
47 switchNumber = 10961 # number part of outgoing on/off messages

Realfire by Rene

Main script for Realfire

Category: Fire
By : Rene10957 Resident
Created: 2015-06-11 Edited: 2015-06-14
Worlds: Second Life

1 // :LICENSE: CC0 (Public Domain). To the extent possible under law, Rene10957 has waived all copyright and related or neighboring rights.For more information, see http://creativecommons.org/publicdomain/zero/1.0/.
2
3 string title = "RealFire"; // title
4 string version = "3.0.1"; // version
5 string notecard = "config"; // notecard name
6
7 // Constants
8
9 integer _PUBLIC_ = 1; // public access bit
10 integer _GROUP_ = 2; // group access bit
11 integer _OWNER_ = 4; // owner access bit
12 integer _GRPOWN_ = 6; // group + owner
13 integer smokeChannel = -15790; // smoke channel
14 float minParticle = 0.0625; // smallest possible particle dimension (SL limit = 0.03125)
15 float maxRed = 1.0; // max. red
16 float maxGreen = 1.0; // max. green
17 float maxBlue = 1.0; // max. blue
18 float maxIntensity = 1.0; // max. light intensity
19 float maxRadius = 20.0; // max. light radius
20 float maxFalloff = 2.0; // max. light falloff
21 float maxVolume = 1.0; // max. volume for sound
22
23 // Notecard variables
24
25 integer verbose = FALSE; // show more/less info during startup
26 integer switchAccess; // access level for switch
27 integer menuAccess; // access level for menu
28 integer msgNumber; // number part of incoming link messages
29 string msgSwitch; // string part of incoming link message: switch (on/off)
30 string msgOn; // string part of incoming link message: switch on
31 string msgOff; // string part of incoming link message: switch off
32 string msgMenu; // string part of incoming link message: show menu
33 string extButton; // "Close" replaced by button text (sends link message)
34 integer extNumber; // number part of outgoing link message
35 integer switchNumber; // number part of outgoing on/off messages
36 integer burnDown = FALSE; // burn down or burn continuously
37 float burnTime; // time to burn in seconds before starting to die
38 float dieTime; // time it takes to die in seconds
39 integer loop = FALSE; // restart after burning down
40 integer changeLight = FALSE; // change light with fire
41 integer changeSmoke = FALSE; // change smoke with fire
42 integer changeVolume = FALSE; // change volume with fire
43 integer singleFire = FALSE; // single fire or multiple fires
44 integer defSize; // default fire size (percentage)
45 float minSize; // min. fire size (percentage)
46 vector defStartColor; // default start (bottom) color (percentage R,G,B)
47 vector defEndColor; // default end (top) color (percentage R,G,B)
48 integer defVolume; // default volume for sound (percentage)
49 integer defSmoke = FALSE; // default smoke on/off
50 integer defSound = FALSE; // default sound on/off
51 integer defIntensity; // default light intensity (percentage)
52 integer defRadius; // default light radius (percentage)
53 integer defFalloff; // default light falloff (percentage)
54
55 // Particle parameters (general)
56
57 float age = 1.0; // particle lifetime
58 float rate = 0.1; // particle burst rate
59 integer count = 10; // particle count
60 vector startColor = <1, 1, 0>; // particle start color
61 vector endColor = <1, 0, 0>; // particle end color
62 float startAlpha = 1.0; // particle start alpha
63 float endAlpha = 0.0; // particle end alpha
64
65 // Particle parameters (resizing)
66
67 vector startScale = <0.4, 2, 0>;// particle start size (100%)
68 vector endScale = <0.4, 2, 0>; // particle end size (100%)
69 float minSpeed = 0.0; // particle min. burst speed (100%)
70 float maxSpeed = 0.04; // particle max. burst speed (100%)
71 float burstRadius = 0.4; // particle burst radius (100%)
72 vector partAccel = <0, 0, 10>; // particle accelleration (100%)
73
74 // Variables
75
76 key owner; // object owner
77 integer line; // notecard line
78 integer loading = FALSE; // notecard loading
79 integer menuChannel; // main menu channel
80 integer startColorChannel; // start color menu channel
81 integer endColorChannel; // end color menu channel
82 integer menuHandle; // handle for main menu listener
83 integer startColorHandle; // handle for start color menu listener
84 integer endColorHandle; // handle for end color menu listener
85 integer perRedStart; // percent red for startColor
86 integer perGreenStart; // percent green for startColor
87 integer perBlueStart; // percent blue for startColor
88 integer perRedEnd; // percent red for endColor
89 integer perGreenEnd; // percent green for endColor
90 integer perBlueEnd; // percent blue for endColor
91 integer perSize; // percent particle size
92 integer perVolume; // percent volume
93 integer on = FALSE; // fire on/off
94 integer burning = FALSE; // burning constantly
95 integer smokeOn = FALSE; // smoke on/off
96 integer soundOn = FALSE; // sound on/off
97 integer menuOpen = FALSE; // a menu is open or canceled (ignore button)
98 float time; // timer interval in seconds
99 float percent; // percentage of perSize (changed by burning down)
100 float percentSmoke; // percentage of smoke
101 float decPercent; // how much to burn down (%) every timer interval
102 vector lightColor; // light color
103 float lightIntensity; // light intensity (changed by burning down)
104 float lightRadius; // light radius (changed by burning down)
105 float lightFalloff; // light falloff
106 float soundVolume; // sound volume (changed by burning down)
107 string sound; // first sound in inventory
108 string texture; // first texture in inventory
109 float startIntensity; // start value of lightIntensity (before burning down)
110 float startRadius; // start value of lightRadius (before burning down)
111 float startVolume; // start value of volume (before burning down)
112
113 // Functions
114
115 string getName(integer link)
116 {
118 return llToLower(str);
119 }
120
121 string getGroup()
122 {
124 if(llToLower(str) == "(no description)" || str == "") str = "Default";
125 return str;
126 }
127
128 toggleFire()
129 {
130 if(on) stopSystem(); else startSystem();
131 }
132
133 toggleSmoke()
134 {
135 if(smokeOn) {
136 sendMessage(0);
137 smokeOn = FALSE;
138 }
139 else {
140 if(changeSmoke) sendMessage(llRound(percentSmoke)); else sendMessage(100);
141 smokeOn = TRUE;
142 }
143 }
144
145 toggleSound()
146 {
147 if(soundOn) {
149 soundOn = FALSE;
150 }
151 else {
152 if(sound) llLoopSound(sound, soundVolume);
153 soundOn = TRUE;
154 }
155 }
156
157 updateSize(float size)
158 {
159 vector start; // start scale
160 vector end; // end scale
161 float radius; // burst radius
162 float min = minSpeed / 100.0 * size; // min. burst speed
163 float max = maxSpeed / 100.0 * size; // max. burst speed
164 vector push = partAccel / 100.0 * size; // accelleration
165
166 if(size < minSize) {
167 start = startScale / 100.0 * minSize;
168 end = endScale / 100.0 * minSize;
169 radius = burstRadius / 100.0 * minSize;
170 }
171 else {
172 start = startScale / 100.0 * size;
173 end = endScale / 100.0 * size;
174 radius = burstRadius / 100.0 * size;
175 }
176
177 if(size > (float)defSize) {
178 lightIntensity = startIntensity;
179 lightRadius = startRadius;
180 percentSmoke = 100.0;
181 soundVolume = startVolume;
182 }
183 else {
184 size *= 100.0 / (float)defSize;
185 if(changeLight) {
186 lightIntensity = percentage(size, startIntensity);
187 lightRadius = percentage(size + 50.0 - size / 2.0, startRadius);
188 }
189 else {
190 lightIntensity = startIntensity;
191 lightRadius = startRadius;
192 }
193 if(changeSmoke) percentSmoke = size; else percentSmoke = 100.0;
194 if(changeVolume) soundVolume = percentage(size, startVolume); else soundVolume = startVolume;
195 }
196
197 updateColor();
198 updateParticles(start, end, min, max, radius, push);
199 if(smokeOn) sendMessage(llRound(percentSmoke));
200 if(sound) if(soundOn) llAdjustSoundVolume(soundVolume);
201 }
202
203 updateColor()
204 {
205 startColor.x = percentage((float)perRedStart, maxRed);
206 startColor.y = percentage((float)perGreenStart, maxGreen);
207 startColor.z = percentage((float)perBlueStart, maxBlue);
208
209 endColor.x = percentage((float)perRedEnd, maxRed);
210 endColor.y = percentage((float)perGreenEnd, maxGreen);
211 endColor.z = percentage((float)perBlueEnd, maxBlue);
212
213 lightColor = (startColor + endColor) / 2.0; // light color = average of start & end color
214 }
215
216 integer accessGranted(key user, integer access)
217 {
218 integer bitmask = _PUBLIC_;
219 if(user == owner) bitmask += _OWNER_;
220 if(llSameGroup(user)) bitmask += _GROUP_;
221 return (bitmask & access);
222 }
223
224 integer checkAccess(string par, string val)
225 {
226 if(llToLower(val) == "public") return _PUBLIC_;
227 if(llToLower(val) == "group") return _GROUP_;
228 if(llToLower(val) == "owner") return _OWNER_;
229 if(llToLower(val) == "group+owner") return _GRPOWN_;
230 llWhisper(0, "[Notecard] " + par + " out of range, corrected to PUBLIC");
231 return _PUBLIC_;
232 }
233
234 integer checkInt(string par, integer val, integer min, integer max)
235 {
236 if(val < min || val > max) {
237 if(val < min) val = min;
238 else if(val > max) val = max;
239 llWhisper(0, "[Notecard] " + par + " out of range, corrected to " + (string)val);
240 }
241 return val;
242 }
243
244 vector checkVector(string par, vector val)
245 {
246 if(val == ZERO_VECTOR) {
247 val = <100,100,100>;
248 llWhisper(0, "[Notecard] " + par + " out of range, corrected to " + (string)val);
249 }
250 return val;
251 }
252
253 integer checkYesNo(string par, string val)
254 {
255 if(llToLower(val) == "yes") return TRUE;
256 if(llToLower(val) == "no") return FALSE;
257 llWhisper(0, "[Notecard] " + par + " out of range, corrected to NO");
258 return FALSE;
259 }
260
261 loadNotecard()
262 {
263 verbose = TRUE;
264 switchAccess = _PUBLIC_;
265 menuAccess = _PUBLIC_;
266 msgNumber = 10959;
267 msgSwitch = "switch";
268 msgOn = "on";
269 msgOff = "off";
270 msgMenu = "menu";
271 extButton = "";
272 extNumber = 10960;
273 switchNumber = 10961;
274 burnDown = FALSE;
275 burnTime = 300.0;
276 dieTime = 300.0;
277 loop = FALSE;
278 changeLight = TRUE;
279 changeSmoke = TRUE;
280 changeVolume = TRUE;
281 singleFire = TRUE;
282 defSize = 25;
283 defStartColor = <100,100,0>;
284 defEndColor = <100,0,0>;
285 defVolume = 100;
286 defSmoke = TRUE;
287 defSound = TRUE;
288 defIntensity = 100;
289 defRadius = 50;
290 defFalloff = 40;
291 line = 0;
292
293 if(!burnDown) burnTime = 315360000; // 10 years
294 time = dieTime / 100.0; // try to get a one percent timer interval
295 if(time < 1.0) time = 1.0; // but never smaller than one second
296 decPercent = 100.0 / (dieTime / time); // and burn down decPercent% every time
297
298 startIntensity = percentage(defIntensity, maxIntensity);
299 startRadius = percentage(defRadius, maxRadius);
300 lightFalloff = percentage(defFalloff, maxFalloff);
301 startVolume = percentage(defVolume, maxVolume);
302
304 loading = TRUE;
305 llSetText("Loading notecard...", <1,1,1>, 1.0);
306 llGetNotecardLine(notecard, line);
307 }
308 else {
309 reset(); // initial values for menu
310 if(on) startSystem();
311 if(verbose) {
312 llWhisper(0, "Notecard \"" + notecard + "\" not found or empty, using defaults");
313 llWhisper(0, "Touch to start/stop fire");
314 llWhisper(0, "Long touch to show menu");
315 if(sound) llWhisper(0, "Sound in object inventory: Yes");
316 else llWhisper(0, "Sound in object inventory: No");
317 llWhisper(0, title + " " + version + " ready");
318 }
319 }
320 }
321
322 readNotecard (string ncLine)
323 {
324 string ncData = llStringTrim(ncLine, STRING_TRIM);
325
326 if(llStringLength(ncData) > 0 && llGetSubString(ncData, 0, 0) != "#") {
327 list ncList = llParseString2List(ncData, ["=","#"], []); // split into parameter, value, comment
330 string lcpar = llToLower(par);
331 if(lcpar == "verbose") verbose = checkYesNo(par, val);
332 else if(lcpar == "switchaccess") switchAccess = checkAccess(par, val);
333 else if(lcpar == "menuaccess") menuAccess = checkAccess(par, val);
334 else if(lcpar == "msgnumber") msgNumber = (integer)val;
335 else if(lcpar == "msgswitch") msgSwitch = val;
336 else if(lcpar == "msgon") msgOn = val;
337 else if(lcpar == "msgoff") msgOff = val;
338 else if(lcpar == "msgmenu") msgMenu = val;
339 else if(lcpar == "extbutton") extButton = llGetSubString(val, 0, 23);
340 else if(lcpar == "extnumber") extNumber = (integer)val;
341 else if(lcpar == "switchnumber") switchNumber = (integer)val;
342 else if(lcpar == "burndown") burnDown = checkYesNo(par, val);
343 else if(lcpar == "burntime") burnTime = (float)checkInt(par, (integer)val, 1, 315360000); // 10 years
344 else if(lcpar == "dietime") dieTime = (float)checkInt(par, (integer)val, 1, 315360000); // 10 years
345 else if(lcpar == "loop") loop = checkYesNo(par, val);
346 else if(lcpar == "changelight") changeLight = checkYesNo(par, val);
347 else if(lcpar == "changesmoke") changeSmoke = checkYesNo(par, val);
348 else if(lcpar == "changevolume") changeVolume = checkYesNo(par, val);
349 else if(lcpar == "singlefire") singleFire = checkYesNo(par, val);
350 else if(lcpar == "size") defSize = checkInt(par, (integer)val, 5, 100);
351 else if(lcpar == "topcolor") defEndColor = checkVector(par, (vector)val);
352 else if(lcpar == "bottomcolor") defStartColor = checkVector(par, (vector)val);
353 else if(lcpar == "volume") defVolume = checkInt(par, (integer)val, 5, 100);
354 else if(lcpar == "smoke") defSmoke = checkYesNo(par, val);
355 else if(lcpar == "sound") defSound = checkYesNo(par, val);
356 else if(lcpar == "intensity") defIntensity = checkInt(par, (integer)val, 0, 100);
357 else if(lcpar == "radius") defRadius = checkInt(par, (integer)val, 0, 100);
358 else if(lcpar == "falloff") defFalloff = checkInt(par, (integer)val, 0, 100);
359 else llWhisper(0, "Unknown parameter in notecard line " + (string)(line + 1) + ": " + par);
360 }
361
362 line++;
363 llGetNotecardLine(notecard, line);
364 }
365
366 menuDialog (key id)
367 {
368 menuOpen = TRUE;
369 string strSmoke = "OFF"; if(smokeOn) strSmoke = "ON";
370 string strSound = "NONE"; if(sound) if(soundOn) strSound = "ON"; else strSound = "OFF";
371 string strButton = "Close"; if(extButton) strButton = extButton;
372 menuChannel = (integer)(llFrand(-1000000000.0) - 1000000000.0);
373 llListenRemove(menuHandle);
374 menuHandle = llListen(menuChannel, "", "", "");
376 llSetTimerEvent(120);
377 llDialog(id, title + " " + version +
378 "\n\nSize: " + (string)perSize + "%\t\tVolume: " + (string)perVolume + "%" +
379 "\nSmoke: " + strSmoke + "\t\tSound: " + strSound, [
380 "Smoke", "Sound", strButton,
381 "-Volume", "+Volume", "Reset",
382 "-Fire", "+Fire", "Color",
383 "Small", "Medium", "Large" ],
384 menuChannel);
385 }
386
387 startColorDialog (key id)
388 {
389 menuOpen = TRUE;
390 startColorChannel = (integer)(llFrand(-1000000000.0) - 1000000000.0);
391 llListenRemove(startColorHandle);
392 startColorHandle = llListen(startColorChannel, "", "", "");
394 llSetTimerEvent(120);
395 llDialog(id, "Bottom color" +
396 "\n\nRed: " + (string)perRedStart + "%" +
397 "\nGreen: " + (string)perGreenStart + "%" +
398 "\nBlue: " + (string)perBlueStart + "%", [
399 "Top color", "One color", "Main menu",
400 "-Blue", "+Blue", "B min/max",
401 "-Green", "+Green", "G min/max",
402 "-Red", "+Red", "R min/max" ],
403 startColorChannel);
404 }
405
406 endColorDialog (key id)
407 {
408 menuOpen = TRUE;
409 endColorChannel = (integer)(llFrand(-1000000000.0) - 1000000000.0);
410 llListenRemove(endColorHandle);
411 endColorHandle = llListen(endColorChannel, "", "", "");
413 llSetTimerEvent(120);
414 llDialog(id, "Top color" +
415 "\n\nRed: " + (string)perRedEnd + "%" +
416 "\nGreen: " + (string)perGreenEnd + "%" +
417 "\nBlue: " + (string)perBlueEnd + "%", [
418 "Bottom color", "One color", "Main menu",
419 "-Blue", "+Blue", "B min/max",
420 "-Green", "+Green", "G min/max",
421 "-Red", "+Red", "R min/max" ],
422 endColorChannel);
423 }
424
425 float percentage (float per, float num)
426 {
427 return num / 100.0 * per;
428 }
429
430 integer min (integer x, integer y)
431 {
432 if(x < y) return x; else return y;
433 }
434
435 integer max (integer x, integer y)
436 {
437 if(x > y) return x; else return y;
438 }
439
440 reset()
441 {
442 smokeOn = defSmoke;
443 soundOn = defSound;
444 perSize = defSize;
445 perVolume = defVolume;
446 perRedStart = (integer)defStartColor.x;
447 perGreenStart = (integer)defStartColor.y;
448 perBlueStart = (integer)defStartColor.z;
449 perRedEnd = (integer)defEndColor.x;
450 perGreenEnd = (integer)defEndColor.y;
451 perBlueEnd = (integer)defEndColor.z;
452 }
453
454 startSystem()
455 {
456 if(!on) llMessageLinked(LINK_SET, switchNumber, (string)TRUE, getGroup());
457 on = TRUE;
458 burning = TRUE;
459 percent = 100.0;
460 percentSmoke = 100.0;
461 smokeOn = !smokeOn;
462 toggleSmoke();
463 startVolume = percentage(perVolume, maxVolume);
464 lightIntensity = startIntensity;
465 lightRadius = startRadius;
466 soundVolume = startVolume;
467 updateSize((float)perSize);
469 if(sound) if(soundOn) llLoopSound(sound, soundVolume);
471 llSetTimerEvent(burnTime);
472 if(menuOpen) {
473 llListenRemove(menuHandle);
474 llListenRemove(startColorHandle);
475 llListenRemove(endColorHandle);
476 menuOpen = FALSE;
477 }
478 }
479
480 stopSystem()
481 {
482 if(on) llMessageLinked(LINK_SET, switchNumber, (string)FALSE, getGroup());
483 on = FALSE;
484 burning = FALSE;
485 percent = 0.0;
486 percentSmoke = 0.0;
488 updateParticles(ZERO_VECTOR, ZERO_VECTOR, 0, 0, 0, ZERO_VECTOR);
490 sendMessage(0);
491 if(menuOpen) {
492 llListenRemove(menuHandle);
493 llListenRemove(startColorHandle);
494 llListenRemove(endColorHandle);
495 menuOpen = FALSE;
496 }
497 }
498
499 updateParticles(vector start, vector end, float min, float max, float radius, vector push)
500 {
501 list particles = [
503 PSYS_SRC_TEXTURE, texture,
504 PSYS_PART_START_COLOR, startColor,
505 PSYS_PART_END_COLOR, endColor,
506 PSYS_PART_START_ALPHA, startAlpha,
507 PSYS_PART_END_ALPHA, endAlpha,
516 PSYS_SRC_ACCEL, push,
518 0 |
523
524 if(singleFire) {
525 if(on) {
526 llParticleSystem(particles);
527 llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, lightColor, lightIntensity, lightRadius, lightFalloff]);
528 }
529 else {
532 }
533 return;
534 }
535
536 integer i;
537 integer number = llGetNumberOfPrims();
538 integer link = llGetLinkNumber();
539 string name = getName(link);
540
541 for (i = number; i >= 0; --i) {
542 if(name == getName(i)) {
543 if(i == link || getName(i) != "object") {
544 if(on) {
545 llLinkParticleSystem(i, particles);
546 llSetLinkPrimitiveParamsFast(i, [
547 PRIM_POINT_LIGHT, TRUE, lightColor, lightIntensity, lightRadius, lightFalloff]);
548 }
549 else {
550 llLinkParticleSystem(i, []);
551 llSetLinkPrimitiveParamsFast(i, [PRIM_POINT_LIGHT, FALSE, ZERO_VECTOR, 0, 0, 0]);
552 }
553 }
554 }
555 }
556 }
557
558 sendMessage(integer size)
559 {
560 llMessageLinked(LINK_ALL_OTHERS, smokeChannel, (string)size, getGroup());
561 }
562
563 default
564 {
566 {
567 minSize = 100.0 / (startScale.x / minParticle); // smallest possible fire size (percentage)
568 owner = llGetOwner();
569 sound = llGetInventoryName(INVENTORY_SOUND, 0); // get first sound from inventory
570 texture = llGetInventoryName(INVENTORY_TEXTURE, 0); // get first texture from inventory
571 if(sound) llPreloadSound(sound);
572 stopSystem();
573 loadNotecard();
574 }
575
576 on_rez(integer start_param)
577 {
579 }
580
581 touch_start(integer total_number)
582 {
584 }
585
586 touch_end(integer total_number)
587 {
588 if(loading) {
589 llWhisper(0, "Notecard is still loading");
590 return;
591 }
592
593 key user = llDetectedKey(0);
594
595 if(llGetTime() > 1.0) {
596 if(accessGranted(user, menuAccess)) {
597 startSystem();
598 menuDialog(user);
599 }
600 else llInstantMessage(user, "[Menu] Access denied");
601 }
602 else {
603 if(accessGranted(user, switchAccess)) toggleFire();
604 else llInstantMessage(user, "[Switch] Access denied");
605 }
606 }
607
608 listen(integer channel, string name, key id, string msg)
609 {
610 if(channel == menuChannel) {
611 llListenRemove(menuHandle);
612 if(msg == "Small") perSize = 25;
613 else if(msg == "Medium") perSize = 50;
614 else if(msg == "Large") perSize = 75;
615 else if(msg == "-Fire") perSize = max(perSize - 5, 5);
616 else if(msg == "+Fire") perSize = min(perSize + 5, 100);
617 else if(msg == "-Volume") {
618 perVolume = max(perVolume - 5, 5);
619 startVolume = percentage(perVolume, maxVolume);
620 }
621 else if(msg == "+Volume") {
622 perVolume = min(perVolume + 5, 100);
623 startVolume = percentage(perVolume, maxVolume);
624 }
625 else if(msg == "Smoke") toggleSmoke();
626 else if(msg == "Sound") toggleSound();
627 else if(msg == "Color") endColorDialog(id);
628 else if(msg == "Reset") { reset(); startSystem(); }
629 else if(msg == extButton) llMessageLinked(LINK_SET, extNumber, msg, id);
630 if(msg != "Color" && msg != "Close" && msg != extButton) {
631 if(msg != "Smoke" && msg != "Sound" && msg != "Reset") updateSize((float)perSize);
632 menuDialog(id);
633 }
634 else {
635 llSetTimerEvent(0); // stop dialog timer
636 llSetTimerEvent(burnTime); // restart burn timer
637 menuOpen = FALSE;
638 }
639 }
640 else if(channel == startColorChannel) {
641 llListenRemove(startColorHandle);
642 if(msg == "-Red") perRedStart = max(perRedStart - 10, 0);
643 else if(msg == "-Green") perGreenStart = max(perGreenStart - 10, 0);
644 else if(msg == "-Blue") perBlueStart = max(perBlueStart - 10, 0);
645 else if(msg == "+Red") perRedStart = min(perRedStart + 10, 100);
646 else if(msg == "+Green") perGreenStart = min(perGreenStart + 10, 100);
647 else if(msg == "+Blue") perBlueStart = min(perBlueStart + 10, 100);
648 else if(msg == "R min/max") { if(perRedStart) perRedStart = 0; else perRedStart = 100; }
649 else if(msg == "G min/max") { if(perGreenStart) perGreenStart = 0; else perGreenStart = 100; }
650 else if(msg == "B min/max") { if(perBlueStart) perBlueStart = 0; else perBlueStart = 100; }
651 else if(msg == "Top color") endColorDialog(id);
652 else if(msg == "Main menu") menuDialog(id);
653 else if(msg == "One color") {
654 perRedEnd = perRedStart;
655 perGreenEnd = perGreenStart;
656 perBlueEnd = perBlueStart;
657 }
658 if(msg != "Top color" && msg != "Main menu") {
659 updateSize((float)perSize);
660 startColorDialog(id);
661 }
662 }
663 else if(channel == endColorChannel) {
664 llListenRemove(endColorHandle);
665 if(msg == "-Red") perRedEnd = max(perRedEnd - 10, 0);
666 else if(msg == "-Green") perGreenEnd = max(perGreenEnd - 10, 0);
667 else if(msg == "-Blue") perBlueEnd = max(perBlueEnd - 10, 0);
668 else if(msg == "+Red") perRedEnd = min(perRedEnd + 10, 100);
669 else if(msg == "+Green") perGreenEnd = min(perGreenEnd + 10, 100);
670 else if(msg == "+Blue") perBlueEnd = min(perBlueEnd + 10, 100);
671 else if(msg == "R min/max") { if(perRedEnd) perRedEnd = 0; else perRedEnd = 100; }
672 else if(msg == "G min/max") { if(perGreenEnd) perGreenEnd = 0; else perGreenEnd = 100; }
673 else if(msg == "B min/max") { if(perBlueEnd) perBlueEnd = 0; else perBlueEnd = 100; }
674 else if(msg == "Bottom color") startColorDialog(id);
675 else if(msg == "Main menu") menuDialog(id);
676 else if(msg == "One color") {
677 perRedStart = perRedEnd;
678 perGreenStart = perGreenEnd;
679 perBlueStart = perBlueEnd;
680 }
681 if(msg != "Bottom color" && msg != "Main menu") {
682 updateSize((float)perSize);
683 endColorDialog(id);
684 }
685 }
686 }
687
688 link_message(integer sender_number, integer number, string msg, key id)
689 {
690 if(number != msgNumber) return;
691
692 if(loading) {
693 llWhisper(0, "Notecard is still loading");
694 return;
695 }
696
697 if(id) {} else {
698 llWhisper(0, "A valid avatar key must be provided in the link message");
699 return;
700 }
701
702 if(msg == msgSwitch) {
703 if(accessGranted(id, switchAccess)) toggleFire();
704 else llInstantMessage(id, "[Switch] Access denied");
705 }
706 else if(msg == msgOn) {
707 if(accessGranted(id, switchAccess)) startSystem();
708 else llInstantMessage(id, "[Switch] Access denied");
709 }
710 else if(msg == msgOff) {
711 if(accessGranted(id, switchAccess)) stopSystem();
712 else llInstantMessage(id, "[Switch] Access denied");
713 }
714 else if(msg == msgMenu) {
715 if(accessGranted(id, menuAccess)) {
716 startSystem();
717 menuDialog(id);
718 }
719 else llInstantMessage(id, "[Menu] Access denied");
720 }
721 }
722
723 dataserver(key req, string data)
724 {
725 if(data == EOF) {
726 if(!burnDown) burnTime = 315360000; // 10 years
727 time = dieTime / 100.0; // try to get a one percent timer interval
728 if(time < 1.0) time = 1.0; // but never smaller than one second
729 decPercent = 100.0 / (dieTime / time); // and burn down decPercent% every time
730
731 defStartColor.x = checkInt("ColorOn (RED)", (integer)defStartColor.x, 0, 100);
732 defStartColor.y = checkInt("ColorOn (GREEN)", (integer)defStartColor.y, 0, 100);
733 defStartColor.z = checkInt("ColorOn (BLUE)", (integer)defStartColor.z, 0, 100);
734 defEndColor.x = checkInt("ColorOff (RED)", (integer)defEndColor.x, 0, 100);
735 defEndColor.y = checkInt("ColorOff (GREEN)", (integer)defEndColor.y, 0, 100);
736 defEndColor.z = checkInt("ColorOff (BLUE)", (integer)defEndColor.z, 0, 100);
737
738 startIntensity = percentage(defIntensity, maxIntensity);
739 startRadius = percentage(defRadius, maxRadius);
740 lightFalloff = percentage(defFalloff, maxFalloff);
741 startVolume = percentage(defVolume, maxVolume);
742
743 reset(); // initial values for menu
744 if(on) startSystem();
745
746 if(verbose) {
747 llWhisper(0, "Touch to start/stop fire");
748 llWhisper(0, "Long touch to show menu");
749 if(sound) llWhisper(0, "Sound in object inventory: Yes");
750 else llWhisper(0, "Sound in object inventory: No");
751 llWhisper(0, title + " " + version + " ready");
752 }
753 loading = FALSE;
754 llSetText("", ZERO_VECTOR, 0.0);
755 }
756 else {
757 readNotecard(data);
758 }
759 }
760
761 changed(integer change)
762 {
763 if(change & CHANGED_INVENTORY) {
764 sound = llGetInventoryName(INVENTORY_SOUND, 0); // get first sound from inventory
765 texture = llGetInventoryName(INVENTORY_TEXTURE, 0); // get first texture from inventory
766 if(sound) llPreloadSound(sound);
767 loadNotecard();
768 }
769 }
770
771 timer()
772 {
773 if(menuOpen) {
774 llListenRemove(menuHandle);
775 llListenRemove(startColorHandle);
776 llListenRemove(endColorHandle);
777 llSetTimerEvent(0); // stop dialog timer
778 llSetTimerEvent(burnTime); // restart burn timer
779 menuOpen = FALSE;
780 return;
781 }
782
783 if(burning) {
785 llSetTimerEvent(time);
786 burning = FALSE;
787 }
788
789 if(percent >= decPercent) {
790 percent -= decPercent;
791 updateSize(percent / (100.0 / (float)perSize));
792 }
793 else {
794 if(loop) startSystem();
795 else stopSystem();
796 }
797 }
798 }

Realfire by Rene

License for RealFire//:VERSION: 3.0.1

Category: Fire
By : Rene10957 Resident
Created: 2015-06-11 Edited: 2015-06-14
Worlds: Second Life

1 //:LICENSE: CC0 (Public Domain). To the extent possible under law, Rene10957 has waived all copyright and related or neighboring rights.For more information, see http://creativecommons.org/publicdomain/zero/1.0/.
2
3 // License for RealFire
4 //
5 // Author: Rene10957 Resident
6 // Date: 31-05-2015
7 // Version: 3.0.1
8
9 CC0 (Public Domain)
10
11 To the extent possible under law, Rene10957 has waived all copyright and related or neighboring rights.
12 For more information, see http://creativecommons.org/publicdomain/zero/1.0/.
13
14 // Third-party components
15
16 Sound file created by dobroide@freesound.org and licensed under the CC BY 3.0 License

Realfire by Rene

Description for RealFire//:VERSION: 3.0.1

Category: Fire
By : Rene10957 Resident
Created: 2015-06-11 Edited: 2015-06-14
Worlds: Second Life

1 //:LICENSE: CC0 (Public Domain). To the extent possible under law, Rene10957 has waived all copyright and related or neighboring rights.For more information, see http://creativecommons.org/publicdomain/zero/1.0/.
2
3 RealFire by Rene
4
5 Menu-controlled realistic particle fire with smoke, light and sound.
6 Features:
7 Fire with smoke, light and sound
8 Burns down at any desired speed, looped or non-looped
9 Change size, color and sound volume
10 Access control: public, group, owner, group+owner
11 Store default settings in notecard
12 Plugin support: call the menu from other scripts
13 Add your own extension button
14 Add more switches to the same fire but never get out of sync
15 Remote control: external switch that works across an entire sim
16 Control panel for up to 9 fires
17 Multiple fires using one
18
19
20 Please note that the user manual is from the website. The site itself is no longer active.
21
22 There may be references to examples that no longer exist.

Realfire by Rene

Smoke slave script - goes into separate linked prims to to make more smoke

Category: Fire
By : Rene10957 Resident
Created: 2015-06-11 Edited: 2015-06-14
Worlds: Second Life

1 // :LICENSE: CC0 (Public Domain). To the extent possible under law, Rene10957 has waived all copyright and related or neighboring rights.For more information, see http://creativecommons.org/publicdomain/zero/1.0/.
2
3
4 string title = "RealSmoke"; // title
5 string version = "3.0"; // version
6 integer silent = TRUE; // silent startup
7
8 // Constants
9
10 integer smokeChannel = -15790; // smoke channel
11 key texture = "5de058da-95f0-2736-b0e0-e218184ddece"; // whispy smoke
12
13 // Particle parameters (general)
14
15 float age = 16.0; // particle lifetime
16 float rate = 0.5; // particle burst rate
17 integer count = 3; // particle count
18 vector startColor = <0.5, 0.5, 0.5>; // particle start color
19 vector endColor = <0.5, 0.5, 0.5>; // particle end color
20 float startAlpha = 1.0; // particle start alpha
21 float endAlpha = 0.0; // particle end alpha
22
23 // Particle parameters (resizing)
24
25 vector startScale = <0.1, 0.1, 0>; // particle start size (100%)
26 vector endScale = <4, 4, 0>; // particle end size (100%)
27 float minSpeed = 0.0; // particle min. burst speed (100%)
28 float maxSpeed = 0.1; // particle max. burst speed (100%)
29 float burstRadius = 0.1; // particle burst radius (100%)
30 vector partAccel = <0, 0, 0.2>; // particle accelleration (100%)
31
32 // Functions
33
34 updateSize(float size)
35 {
36 vector start = startScale / 100.0 * size; // start scale
37 vector end = endScale / 100.0 * size; // end scale
38 float min = minSpeed / 100.0 * size; // min. burst speed
39 float max = maxSpeed / 100.0 * size; // max. burst speed
40 float radius = burstRadius / 100.0 * size; // burst radius
41 vector push = partAccel / 100.0 * size; // accelleration
42
43 updateParticles(start, end, min, max, radius, push);
44 }
45
46 string getGroup()
47 {
49 if(llToLower(str) == "(no description)" || str == "") str = "Default";
50 return str;
51 }
52
53 float percentage (float per, float num)
54 {
55 return num / 100.0 * per;
56 }
57
58 updateParticles(vector start, vector end, float min, float max, float radius, vector push)
59 {
62 PSYS_SRC_TEXTURE, texture,
63 PSYS_PART_START_COLOR, startColor,
64 PSYS_PART_END_COLOR, endColor,
65 PSYS_PART_START_ALPHA, startAlpha,
66 PSYS_PART_END_ALPHA, endAlpha,
75 PSYS_SRC_ACCEL, push,
77 0 |
82 }
83
84 default
85 {
87 {
89 if(!silent) llWhisper(0, title + " " + version + " ready");
90 }
91
92 on_rez(integer start_param)
93 {
95 }
96
97 link_message(integer sender_number, integer number, string msg, key id)
98 {
99 if(number != smokeChannel) return;
100
101 integer size = (integer)msg;
102 string group = (string)id;
103
104 if(group == getGroup() || group == "Default" || getGroup() == "Default") {
105 if(size) updateSize((float)size);
107 }
108 }
109 }

Realfire by Rene

RGB to LSL color conversion

Category: Fire
By : Rene10957 Resident
Created: 2015-06-11 Edited: 2015-06-14
Worlds: Second Life

1 //:LICENSE: CC0 (Public Domain). To the extent possible under law, Rene10957 has waived all copyright and related or neighboring rights.For more information, see http://creativecommons.org/publicdomain/zero/1.0/.
2
3 // Rez a cube, drop the script in it and touch it
4 // Enter the resulting color vector into the notecard next to "topColor" and/or "bottomColor"
5
6 string title = "Color converter"; // title
7 string version = "1.0"; // version
8
9 // Variables
10
11 integer boxChannel; // text box channel
12 integer boxHandle; // handle for text box listener
13
14 default
15 {
17 {
18 llWhisper(0, title + " " + version + " ready");
19 }
20
21 on_rez(integer start_param)
22 {
24 }
25
26 touch_start(integer total_number)
27 {
28 boxChannel = (integer)(llFrand(-1000000000.0) - 1000000000.0);
29 llListenRemove(boxHandle);
30 boxHandle = llListen(boxChannel, "", "", "");
32 llSetTimerEvent(120);
33 llTextBox(llDetectedKey(0), "\nEnter RGB color as <R,G,B>\ne.g. <255,0,0> for red", boxChannel);
34 }
35
36 listen(integer channel, string name, key id, string msg)
37 {
38 if(channel != boxChannel) return;
40 llListenRemove(boxHandle);
41
42 vector rgb = (vector)msg;
43 vector lsl = rgb / 255.0;
44 vector per = lsl * 100.0;
45 per.x = (float)llRound(per.x);
46 per.y = (float)llRound(per.y);
47 per.z = (float)llRound(per.z);
48
49 llOwnerSay("RGB color = " + "< " + (string)((integer)rgb.x) + ", " +
50 (string)((integer)rgb.y) + ", " + (string)((integer)rgb.z) + " >");
51 llOwnerSay("LSL color = " + "< " + (string)lsl.x + ", " +
52 (string)lsl.y + ", " + (string)lsl.z + " >");
53 llOwnerSay("Notecard color = " + "< " + (string)((integer)per.x) + ", " +
54 (string)((integer)per.y) + ", " + (string)((integer)per.z) + " >");
55 }
56
57 timer()
58 {
60 llListenRemove(boxHandle);
61 llOwnerSay("Text box timeout");
62 }
63 }

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