Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Water Vapor Script

Amaranthim Talon
Voyager, Seeker, Curious
Join date: 14 Nov 2006
Posts: 12,032
02-11-2009 11:41
Having reached the decision that I simply cannot keep bugging people that do know how to script for easy solutions, I am attempting to unravel the workings and hopefully learn how to do it myself.

I was fortunate enough to find http://www.heatonresearch.com/examples/particle/particle.html that has a handy script generator. Even though it gives me a working particle script, I still need to tailor it to my needs. I have managed to change the size of the particles, the speed at which they are generated, how high up they go from the source, the color and the texture (pretty good for me, believe me). What I need it to do, though, is to be emitted in a horizontal line as opposed as a single vertical line of particles. But I don't know what part of the script controls that- Would one of you please look at this and point me in the right direction? Thank you muchly.
Here it is as generated by Encog's Particle Machine:

generalParticleEmitterOn()
{
llParticleSystem([
PSYS_PART_FLAGS , 0
|PSYS_PART_WIND_MASK
|PSYS_PART_INTERP_COLOR_MASK
|PSYS_PART_INTERP_SCALE_MASK
|PSYS_PART_FOLLOW_SRC_MASK
|PSYS_PART_FOLLOW_VELOCITY_MASK
|PSYS_PART_EMISSIVE_MASK
,PSYS_SRC_PATTERN,PSYS_SRC_PATTERN_DROP
,PSYS_SRC_TEXTURE,""
,PSYS_SRC_MAX_AGE,0.0
,PSYS_PART_MAX_AGE,(float)4.0
,PSYS_SRC_BURST_RATE,(float)0.5
,PSYS_SRC_BURST_PART_COUNT,6
,PSYS_SRC_BURST_RADIUS,(float)10
,PSYS_SRC_BURST_SPEED_MIN,(float)0.4
,PSYS_SRC_BURST_SPEED_MAX,(float)0.5
,PSYS_SRC_ACCEL,<0,0,1>
,PSYS_PART_START_COLOR,<1,0,0>
,PSYS_PART_END_COLOR,<1,0,0>
,PSYS_PART_START_ALPHA,(float)1
,PSYS_PART_END_ALPHA,(float)1
,PSYS_PART_START_SCALE,<0.25,0.25,0.25>
,PSYS_PART_END_SCALE,<1.5,1.5,1.5>
,PSYS_SRC_ANGLE_BEGIN,0 * DEG_TO_RAD
,PSYS_SRC_ANGLE_END,360 * DEG_TO_RAD
,PSYS_SRC_OMEGA,<0,0,0>
]);
}

generalParticleEmitterOff()
{
llParticleSystem([]);
}

default
{
state_entry()
{
generalParticleEmitterOn();
}

touch_start( integer num )
{
state off;
}
}

state off
{
state_entry()
{
generalParticleEmitterOff();
}

touch_start( integer num )
{
state default;
}
}
_____________________
"Yield to temptation. It may not pass your way again. "
Robert A. Heinlein




http://talonfaire.blogspot.com/

Visit Talon Faire Main:
http://slurl.com/secondlife/Misto%20Presto/216/21/155- Main Store

XStreets: http://tinyurl.com/6r7ayn
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
02-11-2009 11:59
As wriiten, you are giving your particles an acceleration in the +Z direction only. Mess with the vector PHYS_SRC_ACCEL to make the particles head in another direction.

The quickest source of information about particles is . In world, it's VERY smart to go visit the Particle Laboratory (look for it in Search) and play with all of their demo setups until you have a good feel for what the parameters do.

BTW, not that it makes any difference, but technically water vapor is invisible. I suspect that what you want to do is make steam. ;)
Amaranthim Talon
Voyager, Seeker, Curious
Join date: 14 Nov 2006
Posts: 12,032
02-11-2009 12:17
:) You are absolutely right about that- steam i mean. And thank you I will try playing with that setting - thank you so much :)

I have been to the particle lab. My problem is that when you know so little you don't even know what it is you don't know... :) so I am starting to read the LSL tuts in the Wiki for now then may get a print book fro the same gentleman as produces that page i linked above. Thanks for your help.
_____________________
"Yield to temptation. It may not pass your way again. "
Robert A. Heinlein




http://talonfaire.blogspot.com/

Visit Talon Faire Main:
http://slurl.com/secondlife/Misto%20Presto/216/21/155- Main Store

XStreets: http://tinyurl.com/6r7ayn
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
02-11-2009 12:28
Sorry.. Bit of a pet peeve here.. It's just personal preference but using two states here sorta sets my teeth on edge..

I'd do:
CODE

integer POOFS_BY_DEFAULT = TRUE;
integer gParticlesOn;

Update()
{
if (gParticlesOn)
{
generalParticleEmitterOn()
}
else
{
llParticleSystem([]);
}
}

default
{
state_entry()
{
gParticlesOn = POOFS_BY_DEFAULT;
Update();
}

touch_start( integer num )
{
gParticlesOn = !gParticlesOn;
Update();
}
}
CODE
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
Drifter Dreamscape
Registered User
Join date: 30 Mar 2008
Posts: 182
02-11-2009 12:41
From: Rolig Loon

BTW, not that it makes any difference, but technically water vapor is invisible. I suspect that what you want to do is make steam. ;)


I'm trying to understand scripting too but have to be totally anal retentive and correct you on the physical angle - steam is the bit that's totally invisible.
:D
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
02-11-2009 13:05
I should have kept my mouth shut, but I couldn't resist. ;) I was a chemist for a long time in an earlier life. "Steam" is one of those ambiguous words that I always tried to convince students to avoid. The gas phase of water is water vapor. In some contexts, physical chemists (and more commonly, engineers) use "steam" to mean the same thing. That's terribly confusing, because in common parlance "steam" is the visible aerosol of condensed water vapor. (Yeah, I know all about "steam tables." They only make matters worse, thanks to restaurant kitchens. :p ) If I were the language queen, I would use "water vapor" and "condensed water vapor" and forget "steam" altogether except in a colloquial setting. But that's me.
Drifter Dreamscape
Registered User
Join date: 30 Mar 2008
Posts: 182
02-11-2009 13:07
From: Rolig Loon
I should have kept my mouth shut, but I couldn't resist. ;) I was a chemist for a long time in an earlier life. "Steam" is one of those ambiguous words that I always tried to convince students to avoid. The gas phase of water is water vapor. In some contexts, physical chemists (and more commonly, engineers) use "steam" to mean the same thing. That's terribly confusing, because in common parlance "steam" is the visible aerosol of condensed water vapor. (Yeah, I know all about "steam tables." They only make matters worse, thanks to restaurant kitchens. :p ) If I were the language queen, I would use "water vapor" and "condensed water vapor" and forget "steam" altogether except in a colloquial setting. But that's me.


No harm in letting off a little steam, eh??
:D
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
02-11-2009 13:11
Lol..... :D
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
02-11-2009 13:24
From: Meade Paravane
Sorry.. Bit of a pet peeve here.. It's just personal preference but using two states here sorta sets my teeth on edge.
I like states, and Hungarian notation sets my teeth on edge. Nyah!

PS: Rolig ... can you explain SL chemistry to us? :D
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Amaranthim Talon
Voyager, Seeker, Curious
Join date: 14 Nov 2006
Posts: 12,032
02-11-2009 13:33
Well I won't pretend to understand Meade's comment about different states...

So.. I tweaked the PHYS_SRC_ACCEL portion and managed to get it to lay flat as it were in relation to camera angle, i.e. right in front of it. However, when I cam around it, the angles seem to shift... I see I am missing something.. like i said, i know i have a lot to learn and i don't really want it done for me- I want to understand if not so much yet the why but at least the how- why can come later.
_____________________
"Yield to temptation. It may not pass your way again. "
Robert A. Heinlein




http://talonfaire.blogspot.com/

Visit Talon Faire Main:
http://slurl.com/secondlife/Misto%20Presto/216/21/155- Main Store

XStreets: http://tinyurl.com/6r7ayn
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
02-11-2009 13:52
Hmmmm..... this calls for greater talent than mine. I'm still barely beyond the "tweak this and see what happens" phase, myself. I'm not exactly sure what you're seeing, but if the problem is that particles don't move with the emitting object, you might try setting PSYS_PART_FOLLOW_SRC_MASK to TRUE.
Amaranthim Talon
Voyager, Seeker, Curious
Join date: 14 Nov 2006
Posts: 12,032
02-11-2009 14:20
Sure can't hurt :) (She said and the grid blew up around her....)

:) I will play with that setting then tonight.
_____________________
"Yield to temptation. It may not pass your way again. "
Robert A. Heinlein




http://talonfaire.blogspot.com/

Visit Talon Faire Main:
http://slurl.com/secondlife/Misto%20Presto/216/21/155- Main Store

XStreets: http://tinyurl.com/6r7ayn
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
02-11-2009 14:36
Apologies Amar, the guys here tend to get a little excited and rowdy when a new female shows any interest in scripting. You know, jump up and down, beat their hands on their chests and bang rocks together. From that point they proceed to doing stuff like showing off their superior intellect and vast knowledge of things like various states of water. It seems to be some form of geek mating ritual. Basically it translates to Hi!, you are pretty and we like you! Fortunately they have grown paste the stage of pulling our hair to show thier affection:p .

OK what our hedgehog was trying to explain, state changes just really are not necessary in a case like this. There is actually a simple way to do it and that is called an "integer switch". It works just like turning a light switch off and on. Here is your code changed around a little bit and should be easier to read and understand:

CODE

integer on = 1;//in LSL and many languages TRUE = 1 and FALSE = 0

particles() {
llParticleSystem([PSYS_PART_FLAGS, 0 //Putting each flag and variable on
//thier own lines. Easier to read and edit
| PSYS_PART_WIND_MASK
| PSYS_PART_INTERP_COLOR_MASK
| PSYS_PART_INTERP_SCALE_MASK
| PSYS_PART_FOLLOW_SRC_MASK
| PSYS_PART_FOLLOW_VELOCITY_MASK
| PSYS_PART_EMISSIVE_MASK,
PSYS_SRC_PATTERN,
PSYS_SRC_PATTERN_DROP,
PSYS_SRC_TEXTURE, "",
PSYS_SRC_MAX_AGE, 0.0,
PSYS_PART_MAX_AGE, (float) 4.0,
PSYS_SRC_BURST_RATE, (float) 0.5,
PSYS_SRC_BURST_PART_COUNT, 6,
PSYS_SRC_BURST_RADIUS, (float) 10,
PSYS_SRC_BURST_SPEED_MIN,(float) 0.4,
PSYS_SRC_BURST_SPEED_MAX, (float) 0.5,
PSYS_SRC_ACCEL, <0, 1, 0 >,//adjust these values to make it go sideways
PSYS_PART_START_COLOR, <1, 0, 0 >,
PSYS_PART_END_COLOR, <1, 0, 0 >,
PSYS_PART_START_ALPHA,(float) 1,
PSYS_PART_END_ALPHA, (float) 1,
PSYS_PART_START_SCALE, <0.25, 0.25, 0.25 >,
PSYS_PART_END_SCALE, <1.5, 1.5, 1.5 >,
PSYS_SRC_ANGLE_BEGIN, 0 * DEG_TO_RAD,
PSYS_SRC_ANGLE_END,360 * DEG_TO_RAD,
PSYS_SRC_OMEGA, <0, 0, 0 >
]);
}

default {
touch_start(integer num) {
if (on) {//if(on) means the same as "if(on == TRUE)"
particles();
}
else {//If it is not true
llParticleSystem([]);
}
on = !on;//simple integer switch. This means "change my value
//between 1 and 0" aka "TRUE and FALSE"
}
}


I tested this in world and the particle direction did not change as I cammed around. Hope it helps.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
02-11-2009 14:39
Why all the animosity towards states?
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
02-11-2009 14:43
From: Argent Stonecutter
Why all the animosity towards states?

Just depends on the state. Texas and Pennsylvania are alright but New Jersey sucks.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
02-11-2009 14:44
Federalists, maybe?
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
02-11-2009 14:45
Hungarians.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
02-11-2009 14:49
From: Amaranthim Talon
So.. I tweaked the PHYS_SRC_ACCEL portion and managed to get it to lay flat as it were in relation to camera angle, i.e. right in front of it. However, when I cam around it, the angles seem to shift...

Just thought of something. Do you mean the particles are changing direction they are coming out of the prim or............ Are you talking about the fact that the textures change to face the camera? If it is the latter.... Particles are simply a 2D picture like a photo, that photo always faces the camera.

EDIT: Nevermind I caught it. The angle was changing because you have PSYS_PART_WIND_MASK, which means the particles will go whichever way the wind is blowing. Try it like this:

CODE

integer on = 1;//in LSL and many languages TRUE = 1 and FALSE = 0

particles() {
llParticleSystem([PSYS_PART_FLAGS, 0 //Putting each flag and variable on
//thier own lines. Easier to read and edit
//| PSYS_PART_WIND_MASK this is why the angle was changing
| PSYS_PART_INTERP_COLOR_MASK
| PSYS_PART_INTERP_SCALE_MASK
| PSYS_PART_FOLLOW_SRC_MASK
| PSYS_PART_FOLLOW_VELOCITY_MASK
| PSYS_PART_EMISSIVE_MASK,
PSYS_SRC_PATTERN,
PSYS_SRC_PATTERN_DROP,
PSYS_SRC_TEXTURE, "",
PSYS_SRC_MAX_AGE, 0.0,
PSYS_PART_MAX_AGE, (float) 4.0,
PSYS_SRC_BURST_RATE, (float) 0.5,
PSYS_SRC_BURST_PART_COUNT, 6,
PSYS_SRC_BURST_RADIUS, (float) 10,
PSYS_SRC_BURST_SPEED_MIN,(float) 0.4,
PSYS_SRC_BURST_SPEED_MAX, (float) 0.5,
PSYS_SRC_ACCEL, <0, 1, 0 >,//adjust these values to make it go sideways
PSYS_PART_START_COLOR, <1, 0, 0 >,
PSYS_PART_END_COLOR, <1, 0, 0 >,
PSYS_PART_START_ALPHA,(float) 1,
PSYS_PART_END_ALPHA, (float) 1,
PSYS_PART_START_SCALE, <0.25, 0.25, 0.25 >,
PSYS_PART_END_SCALE, <1.5, 1.5, 1.5 >,
PSYS_SRC_ANGLE_BEGIN, 0 * DEG_TO_RAD,
PSYS_SRC_ANGLE_END,360 * DEG_TO_RAD,
PSYS_SRC_OMEGA, <0, 0, 0 >
]);
}

default {
touch_start(integer num) {
if (on) {//if(on) means the same as "if(on == TRUE)"
particles();
}
else {//If it is not true
llParticleSystem([]);
}
on = !on;//simple integer switch. This means "change my value
//between 1 and 0" aka "TRUE and FALSE"
}
}
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Paladin Pinion
The other one of 10
Join date: 3 Aug 2007
Posts: 191
02-11-2009 15:08
From: Amaranthim Talon

I was fortunate enough to find http://www.heatonresearch.com/examples/particle/particle.html that has a handy script generator. Even though it gives me a working particle script, I still need to tailor it to my needs.


I have been writing an off-line particle script generator. It works a bit like the web page you mention, but includes help text to explain what each parameter does, an angle-viewer diagram to see what angle will be formed by the parameter settings, a color picker that translates the OS system colors into SL vectors, and a few other things. It also contains several templates for common particle systems and the ability to save and retrieve particle system settings to/from disk. It does not show particle size or create actual moving particles, those have to be viewed in SL.

A button generates either of two types of scripts that can be pasted into SL: a "touch toggle" script that turns particles off and on (using an integer toggle) and a plain llParticleSystem structure that can be pasted into any existing script.

I was toying with idea of releasing this for a small fee. Would this be of any interest? Apologies if this belongs in a different thread, or doesn't belong here at all.
Paladin Pinion
The other one of 10
Join date: 3 Aug 2007
Posts: 191
02-11-2009 15:28
From: Jesse Barnett
Apologies Amar, the guys here tend to get a little excited and rowdy when a new female shows any interest in scripting. You know, jump up and down, beat their hands on their chests and bang rocks together.


This made me laugh. :) For what it's worth, I'm female too. I only mention it because I want to see the guys bang rocks together.
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
02-11-2009 16:16
I could go for that. Beats having them pull our hair again.:p
Yingzi Xue
Registered User
Join date: 11 Jun 2008
Posts: 144
02-11-2009 17:15
It can be tedious changing llParticleSystem statements repeatedly to try and get the results you're looking for. I highly suggest you invest in a particle generator that gives you real-time results as you adjust the settings. This is the best way to learn what the different settings do. If you get a particle generator I suggest you get one that accepts chat commands and presets. I've written one, but it's not on the market yet. If you want to try it out get ahold of me in-world and I'll give you a copy. You enter chat commands that change the particles in real-time so you can see exactly you're doing. It also reads and parses llParticleSystem statements as presets from notecards and generates llParticleSystem statements. A particle generator will make your life a lot easier.
Amaranthim Talon
Voyager, Seeker, Curious
Join date: 14 Nov 2006
Posts: 12,032
02-11-2009 17:41
@ Jesse :) Thanks! I will definitely try it out. The hardest part is that none of this is written in English! Or heck, Swahili would be fine - just run it thru BabelFish :D - thing is it isn't written in a way people with no programing experience are going to easily grasp it. It is not intuitive.

@ Paladin- I certainly would not mind buying a toll to learn from and use- I have several tools that have helped me to learn prim manipulation- this would be similar- I would just want to learn as well. I have the Particle Magic thing someone gave me, but it is meant for folks that already know what to do with scripts; it assumes you know what needs tweaking.

@ Yingzi - I would love a copy - if it will help you to figure out how a total novice would use it, since unless it is very easy I would not understand what to do with it :).

I will be in world in about an hour to try out these new changes- thanks folks for all the input.
_____________________
"Yield to temptation. It may not pass your way again. "
Robert A. Heinlein




http://talonfaire.blogspot.com/

Visit Talon Faire Main:
http://slurl.com/secondlife/Misto%20Presto/216/21/155- Main Store

XStreets: http://tinyurl.com/6r7ayn
Amaranthim Talon
Voyager, Seeker, Curious
Join date: 14 Nov 2006
Posts: 12,032
02-11-2009 19:16
From: Rolig Loon
I could go for that. Beats having them pull our hair again.:p

Oh I don't know.....;)
_____________________
"Yield to temptation. It may not pass your way again. "
Robert A. Heinlein




http://talonfaire.blogspot.com/

Visit Talon Faire Main:
http://slurl.com/secondlife/Misto%20Presto/216/21/155- Main Store

XStreets: http://tinyurl.com/6r7ayn
Destiny Niles
Registered User
Join date: 23 Aug 2006
Posts: 949
02-11-2009 19:51
In the inventory is another sample script
library - textures - waterfals - particle system - waterfall mist
1 2