Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Fancy helping a dunce finish a fireplace?

Prawnyloks Parker
"Prim Fiddler"
Join date: 6 Oct 2006
Posts: 420
03-08-2009 13:08
I know that this has been asked before, and I've trawled the scripting forums for the last few days trying to figure this out for myself, but I am no scripter :(

I've built a nice fireplace that's made up of a couple of logs housed in a stone surround. The base log has a particle fire script and texture to go with it, as well as a crackling sound and sound loop script. The top log just has the particle fire script and texture (to add a bit of depth to the fire).

What I want to do is make it so all the particles and sound can be turned on and off, either by touch or chat.

Anyone in a generous mood and fancy helping a scripting dunce out?
Building comes naturally, but I just can't get my head around scripting :o
_____________________
PP Designs - The Home of Low Prim Designs - low prim prefabs & furniture



http://slurl.com/secondlife/nuclear/236/240/21 (main store)
or http://slurl.com/secondlife/huntsman/162/112/115
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
03-08-2009 14:01
CODE

string gStrAuthorized = "Fire Control";

default{
state_entry(){
//-- insert particle/ sound script
}

touch_start( integer vIntNull ){
llMessageLinked( LINK_ALL_OTHERS, FALSE, vStrAuthorized, "" );
state fireOff;
}

link_message( integer vIntNull, integer vIntCode, string vStrVerify, key vKeyNull ){
if (!vIntCode && (gStrAuthorized == vStrVerify)){
state fireOff;
}
}

state fireOff{
state_entry(){
llParticleSystem( [] );
llStopeSound();
}

touch_start( integer vIntNull ){
llMessageLinked( LINK_ALL_OTHERS, TRUE, vStrAuthorized, "" );
state default;
}

link_message( integer vIntNull, integer vIntCode, string vStrVerify, key vKeyNull ){
if (vIntCode && (gStrAuthorized == vStrVerify)){
state default;
}
}
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Prawnyloks Parker
"Prim Fiddler"
Join date: 6 Oct 2006
Posts: 420
03-09-2009 10:26
Thanks Void. I'll check this out asap. Might not get to figure it out properly for a couple of day though as RL stuff has cropped up :(
_____________________
PP Designs - The Home of Low Prim Designs - low prim prefabs & furniture



http://slurl.com/secondlife/nuclear/236/240/21 (main store)
or http://slurl.com/secondlife/huntsman/162/112/115
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
03-09-2009 14:39
you can omit the touch events and the check variable at the top for the child prim logs, and if your root prim isn't the log, remove the check variable state entry and link message events.

why? because that example is really just a demonstration of how to use and synch states. all it really needs in non root logs is an if statement that triggers the sound and particles on or off, but I felt educational.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -