Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Fog machine with timer?

Ilianexsi Sojourner
Chick with Horns
Join date: 11 Jul 2004
Posts: 1,707
10-07-2007 13:47
I'm a complete novice with scripting, but I've been curious lately about whether this could be done, so I thought I'd ask. With Halloween getting close, I've seen fog machine objects for sale, and I've seen lamps with timers that go on automatically at night. I'm just curious, could these two be combined-- a fog machine with a timer, so that the fog starts up automatically when SL night falls, and stops at dawn? It'd be a neat gadget to have for mainland places where the landowner can't control the day/night cycle, but would like to have a little seasonal atmosphere. Thanks!
_____________________
Everything's impossible,'till it ain't. --Ben Hawkins, Carnivale

Help build a Utopian Playland-- www.doctorsteel.com. Music, robots, fun times!
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
10-07-2007 23:43
possible.... yes
useful....... maybe

I say that because I've seen many halloween builds that suggest that you change your "force sun" setting to sunset, or midnight.... in either case, the fog will be tied to the sim sun, and not the local force sun setting....

the scripted lights generally work by getting the sim sun height, add to fog machine, voila
Papalopulus Kobolowski
working mind
Join date: 11 Aug 2006
Posts: 326
10-08-2007 14:19
Maybe this is that you need.
Edit and adjust the particules for your own use .If I miss something please reply again.
The script check every 180sec (3min) its good to increase the time for save sim resources, I think the sun state change every 20min, correct me if I m wrong.
I hope this script help to your proyect

CODE


// Mask Flags - set to TRUE to enable
integer glow = TRUE; // Make the particles glow
integer bounce = FALSE; // Make particles bounce on Z plan of object
integer interpColor = TRUE; // Go from start to end color
integer interpSize = TRUE; // Go from start to end size
integer wind = FALSE; // Particles effected by wind
integer followSource = FALSE; // Particles follow the source
integer followVel = FALSE; // Particles turn to velocity direction

// Choose a pattern from the following:
// PSYS_SRC_PATTERN_EXPLODE
// PSYS_SRC_PATTERN_DROP
// PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY
// PSYS_SRC_PATTERN_ANGLE_CONE
// PSYS_SRC_PATTERN_ANGLE
integer pattern = PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY;

// Select a target for particles to go towards
// "" for no target, "owner" will follow object owner
// and "self" will target this object
// or put the key of an object for particles to go to
key target = "";

// Particle paramaters
float age = 20.1; // Life of each particle
float maxSpeed = 1.0; // Max speed each particle is spit out at
float minSpeed = 1.0; // Min speed each particle is spit out at
string texture; // Texture used for particles, default used if blank
float startAlpha = 1.0; // Start alpha (transparency) value
float endAlpha = 1.0; // End alpha (transparency) value
vector startColor = <238,233,167>; // Start color of particles <R,G,B>
vector endColor = <238,233,167>; // End color of particles <R,G,B> (if interpColor == TRUE)
vector startSize = <4.0,4.0,0>; // Start size of particles
vector endSize = <4.0,4.0,0>; // End size of particles (if interpSize == TRUE)
vector push = <0,0,0>; // Force pushed on particles

// System paramaters
float rate = 20.0; // How fast (rate) to emit particles
float radius = 0.0; // Radius to emit particles for BURST pattern
integer count = 1; // How many particles to emit per BURST
//float outerAngle = 0; // Outer angle for all ANGLE patterns
//float innerAngle = 0; // Inner angle for all ANGLE patterns
vector omega = <0,0,0>; // Rotation of ANGLE patterns around the source
float life = 0; // Life in seconds for the system to make particles

// Script variables
integer flags;

updateParticles()
{
flags = 0;
if (target == "owner") target = llGetOwner();
if (target == "self") target = llGetKey();
if (glow) flags = flags | PSYS_PART_EMISSIVE_MASK;
if (bounce) flags = flags | PSYS_PART_BOUNCE_MASK;
if (interpColor) flags = flags | PSYS_PART_INTERP_COLOR_MASK;
if (interpSize) flags = flags | PSYS_PART_INTERP_SCALE_MASK;
if (wind) flags = flags | PSYS_PART_WIND_MASK;
if (followSource) flags = flags | PSYS_PART_FOLLOW_SRC_MASK;
if (followVel) flags = flags | PSYS_PART_FOLLOW_VELOCITY_MASK;
if (target != "") flags = flags | PSYS_PART_TARGET_POS_MASK;

llParticleSystem([ PSYS_PART_MAX_AGE,age,
PSYS_PART_FLAGS,flags,
PSYS_PART_START_COLOR, startColor,
PSYS_PART_END_COLOR, endColor,
PSYS_PART_START_SCALE,startSize,
PSYS_PART_END_SCALE,endSize,
PSYS_SRC_PATTERN, pattern,
PSYS_SRC_BURST_RATE,rate,
PSYS_SRC_ACCEL, push,
PSYS_SRC_BURST_PART_COUNT,count,
PSYS_SRC_BURST_RADIUS,radius,
PSYS_SRC_BURST_SPEED_MIN,minSpeed,
PSYS_SRC_BURST_SPEED_MAX,maxSpeed,
PSYS_SRC_TARGET_KEY,target,
// PSYS_SRC_INNERANGLE,innerAngle,
// PSYS_SRC_OUTERANGLE,outerAngle,
PSYS_SRC_OMEGA, omega,
PSYS_SRC_MAX_AGE, life,
PSYS_SRC_TEXTURE, texture,
PSYS_PART_START_ALPHA, startAlpha,
PSYS_PART_END_ALPHA, endAlpha]);
}

default // daytime state
{
state_entry()
{
llSetTimerEvent(180); // Check every 3 minutes
}
timer()
{
vector sun = llGetSunDirection();
if (sun.z < 0) state night;

llParticleSystem([]);
}

}

state night
{
state_entry()
{
llSetTimerEvent(120); // Check every 3 minutes
}
timer()
{
vector sun = llGetSunDirection();
if (sun.z > 0) state default; // Change back to daytime state
updateParticles();

}

}
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-08-2007 15:08
Go to the particle laboratory. He should have a sun sensor there and also a basic particle script. If you go around the stations you should find one that does fog and you can see waht the settings are. That place is a treasure and great fun.
_____________________
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