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
Particles Command_Bubbles  

Command_Bubbles

Command Bubbles.lsl

Category: Particles
By : Mike Zidane
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for Command_Bubbles
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Command_Bubbles_1.lsl
1
2 // Particle Script by Mike Zidane
3 // Do what you want with this, but keep it free and post your changes to the boards.
4
5 // Give this effect a name, and when it hears it's name called via linkmessage,
6 // it will wait for START_DELAY to expire, then then fire.
7 // Define your effect in the define_effect() function.
8
9 // Seagel Neville modified this touch control to listen control.
10
11
12
13 string EFFECT_NAME = "bubbles";
14
15 float START_DELAY = 0;
16
17
18 //Don't muck around with the declarations.
19 ///////////////////////////////////////////////////////////////////////////////
20 integer flags;
21 integer we_want_the_particle_to_glow;
22 integer we_want_the_particle_to_bounce;
23 integer we_want_the_particle_to_change_color;
24 integer we_want_the_particle_to_change_size;
25 integer we_want_the_particle_to_follow_wind;
26 integer we_want_the_particle_to_follow_its_source;
27 integer we_want_the_particle_to_spin_as_it_turns;
28 key we_want_the_effect_to_move_towards;
29 float we_want_each_particle_to_last_for;
30 float the_fastest_particles_will_be_ejected_at;
31 float the_slowest_particles_will_be_ejected_at;
32 string each_particle_should_have_this_texture;
33 float when_a_particle_is_created_it_will_have_an_alpha_value_of;
34 float and_then_it_will_gradually_shift_to_an_alpha_value_of;
35 vector when_a_particle_is_created_it_will_have_a_color_value_of;
36 vector and_then_it_will_gradually_shift_to_a_color_value_of;
37 vector new_particles_start_at_this_size;
38 vector and_change_to_this_size;
39 vector apply_this_constant_force_to_our_particles;
40 float we_want_to_create_new_particles_every;
41 float create_new_particles_this_far_from_the_prim;
42 integer create_this_number_of_particles_at_a_time;
43 float particles_should_fan_out_this_wide;
44 float spin_the_fan_this_far_around_the_center_of_the_emitter;
45 vector the_emmitter_will_spin_at_this_rate;
46 float the_emmitter_will_create_particles_for_this_long;
47 integer burst = PSYS_SRC_PATTERN_EXPLODE;
48 integer none = PSYS_SRC_PATTERN_DROP;
49 integer empty_cone = PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY;
50 integer cone = PSYS_SRC_PATTERN_ANGLE_CONE;
51 integer fan = PSYS_SRC_PATTERN_ANGLE;
52 integer we_want_the_effect_to_be_shaped_like_a;
53
54 //Don't muck around with the functions either.
55 float randBetween(float min, float max)
56 {
57 return llFrand(max - min) + min;
58 }
59
60 wait_for(float delay)
61 {
62 llSleep(delay);
63 }
64
65
66 //except this one. This is where you do your thing.
67 define_effect()
68 {
69 we_want_the_particle_to_glow = FALSE;
70
71 we_want_the_particle_to_bounce = FALSE;
72
73 we_want_the_particle_to_change_color = FALSE;
74
75 we_want_the_particle_to_change_size = TRUE;
76
77 we_want_the_particle_to_follow_wind = TRUE;
78
79 we_want_the_particle_to_follow_its_source = FALSE;
80
81 we_want_the_particle_to_spin_as_it_turns = TRUE;
82
83 we_want_the_effect_to_be_shaped_like_a = cone
84 // burst
85 // empty_cone
86 // cone
87 // fan
88 // none (= DROP)
89 ;
90
91 we_want_the_effect_to_move_towards = ""; //(use a key,self,or owner inside the quotes)
92
93 we_want_each_particle_to_last_for = 10.0; //seconds.
94
95 the_fastest_particles_will_be_ejected_at = 0.750; // meters per second.
96
97 the_slowest_particles_will_be_ejected_at = 0.250; // meters per second.
98
99 each_particle_should_have_this_texture = "fda6b800-b2c5-e859-5c1a-27a88457f7df";
100 //(a key is preferred here. use "" for none.)
101
102 when_a_particle_is_created_it_will_have_an_alpha_value_of = 0.5;
103 //(0.0 is transparent, 1.0 is opaque.)
104
105 and_then_it_will_gradually_shift_to_an_alpha_value_of = 0.1;
106 //over the life of the particle.
107
108 when_a_particle_is_created_it_will_have_a_color_value_of = <1.0,1.0,1.0>;
109
110 and_then_it_will_gradually_shift_to_a_color_value_of = <1.0,1.0,1.0>;
111 //over the life of the particle.
112
113 new_particles_start_at_this_size = <0.1,0.1,0.1>;
114
115 and_change_to_this_size = <0.25,0.25,0.25>;
116 //over the life of the particle.
117
118 apply_this_constant_force_to_our_particles = <0.0,0.0,0.0005>;
119
120 we_want_to_create_new_particles_every = 0.1; //seconds.
121
122 create_new_particles_this_far_from_the_prim = 0.0; //for burst patterns only.
123
124 create_this_number_of_particles_at_a_time = 2;
125
126 //for angle patterns,
127 particles_should_fan_out_this_wide = 0; //in radians
128
129 spin_the_fan_this_far_around_the_center_of_the_emitter = 0; //,also in radians.
130
131 the_emmitter_will_spin_at_this_rate = <0,0,0>;
132
133 the_emmitter_will_create_particles_for_this_long = 2; //in seconds
134
135 }
136
137
138 //definitely definitely do not mess with this.
139 update_particle_effect()
140 {
141 flags = 0;
142 if(we_want_the_effect_to_move_towards == "owner") we_want_the_effect_to_move_towards = llGetOwner();
143 if(we_want_the_effect_to_move_towards == "self") we_want_the_effect_to_move_towards = llGetKey();
144 if(we_want_the_particle_to_glow) flags = flags | PSYS_PART_EMISSIVE_MASK;
145 if(we_want_the_particle_to_bounce) flags = flags | PSYS_PART_BOUNCE_MASK;
146 if(we_want_the_particle_to_change_color) flags = flags | PSYS_PART_INTERP_COLOR_MASK;
147 if(we_want_the_particle_to_change_size) flags = flags | PSYS_PART_INTERP_SCALE_MASK;
148 if(we_want_the_particle_to_follow_wind) flags = flags | PSYS_PART_WIND_MASK;
149 if(we_want_the_particle_to_follow_its_source) flags = flags | PSYS_PART_FOLLOW_SRC_MASK;
150 if(we_want_the_particle_to_spin_as_it_turns) flags = flags | PSYS_PART_FOLLOW_VELOCITY_MASK;
151 if(we_want_the_effect_to_move_towards != "") flags = flags | PSYS_PART_TARGET_POS_MASK;
152
153 llParticleSystem([ PSYS_PART_MAX_AGE,we_want_each_particle_to_last_for,
154 PSYS_PART_FLAGS,flags,
155 PSYS_PART_START_COLOR, when_a_particle_is_created_it_will_have_a_color_value_of,
156 PSYS_PART_END_COLOR, and_then_it_will_gradually_shift_to_a_color_value_of,
157 PSYS_PART_START_SCALE,new_particles_start_at_this_size,
158 PSYS_PART_END_SCALE,and_change_to_this_size,
159 PSYS_SRC_PATTERN, we_want_the_effect_to_be_shaped_like_a,
160 PSYS_SRC_BURST_RATE,we_want_to_create_new_particles_every,
161 PSYS_SRC_ACCEL, apply_this_constant_force_to_our_particles,
162 PSYS_SRC_BURST_PART_COUNT,create_this_number_of_particles_at_a_time,
163 PSYS_SRC_BURST_RADIUS,create_new_particles_this_far_from_the_prim,
164 PSYS_SRC_BURST_SPEED_MIN,the_slowest_particles_will_be_ejected_at,
165 PSYS_SRC_BURST_SPEED_MAX,the_fastest_particles_will_be_ejected_at,
166 PSYS_SRC_TARGET_KEY,we_want_the_effect_to_move_towards,
167 PSYS_SRC_INNERANGLE,spin_the_fan_this_far_around_the_center_of_the_emitter,
168 PSYS_SRC_OUTERANGLE,particles_should_fan_out_this_wide,
169 PSYS_SRC_OMEGA, the_emmitter_will_spin_at_this_rate,
170 PSYS_SRC_MAX_AGE, the_emmitter_will_create_particles_for_this_long,
171 PSYS_SRC_TEXTURE, each_particle_should_have_this_texture,
172 PSYS_PART_START_ALPHA, when_a_particle_is_created_it_will_have_an_alpha_value_of,
173 PSYS_PART_END_ALPHA, and_then_it_will_gradually_shift_to_an_alpha_value_of
174 ]);
175 }
176
177
178 integer RUNNING = FALSE;
179
180 start_particle_effect()
181 {
182 RUNNING = TRUE;
183 define_effect();
184 update_particle_effect();
185 }
186
187 clear_the_effect()
188 {
189 RUNNING = FALSE;
191 }
192
193 default
194 {
195
196 // The followings are original.
197
198 // state_entry()
199 // {
200 // clear_the_effect();
201 // }
202 //
203 // on_rez(integer NOT_USED)
204 // {
205 // clear_the_effect();
206 // }
207 //
208 // touch_start(integer NOT_USED)
209 // {
210 // start_particle_effect();
211 // }
212
213 // Seagel changed here.
215 {
216 clear_the_effect();
217 llListen( 0, "", NULL_KEY, "" );
218 }
219
220 on_rez(integer NOT_USED)
221 {
222 clear_the_effect();
223 }
224 listen( integer channel, string name, key id, string message )
225 {
226 if( message == "Mmmm" )
227 {
228 start_particle_effect();
229 }
230 }
231 // That's all.
232
233 link_message(integer NoT_USED, integer NOt_USED, string the_passed_name, key NOT_uSED)
234 {
235 if(the_passed_name == EFFECT_NAME)
236 {
237 if(RUNNING == FALSE)
238 {
239 wait_for(START_DELAY);
240 start_particle_effect();
241 }
242 else
243 {
244 clear_the_effect();
245 }
246 }
247 }
248 }// END //

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