Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

" On / Off " script Required

Farthington Whetmore
Neuros House of Fire
Join date: 18 Oct 2006
Posts: 8
01-03-2007 09:34
Greetings All and HAPPY NEW YEAR!

I have just looked throught the 16 pages of this forum but I can't find what I am looking for... I seek a simple " On / Off " script that would either activate or deactivate a fire in a fireplace by just touching the object.

Your help would be greatly appreciated :)

Thanks
_____________________


"Fire Rejuvenates the Soul"
Perwin Rambler
Registered User
Join date: 24 Mar 2005
Posts: 152
hmm
01-03-2007 09:59
This is making assumptions that the fire place is all linked and I can't fully be sure of the commands at this time, plus I won't have the script needed for the child prims (flames themselves)|particles (particle flames?) but

CODE

integer FireOn=0;

default
{
state_entry()
{
if(FireOn == 0 )
{
llLinkedMessage(LINK_SET,"fireoff"); // I am sure this command may need more options, look it up in the Wiki This will make sure that once rezed the fire will be turned off
}

on_rez(integer param)
{
llResetScript(); // Always a good idea to have this on_rez funtion
}

touch_start(integer tparam)
{
if(FireOn == 0 )
{
llLinkedMessage(LINK_SET,"fireon"); // I am sure this command may need more options, look it up in the Wiki
FireOn = 1;
}
else
{
llLinkedMessage(LINK_SET,"fireoff"); // I am sure this command may need more options, look it up in the Wiki
FireOn = 0;
}
}

}


After this you would need the particles script OR the child flame prims(which I assume here) to have a script that has a linked_message function in them to receive the on and off commands.

I am sorry to say at this time this is where my help must stop, I am at work and can not verify anything I have typed or gather more command information.

The Wiki can help you out a lot with what you need to do.
I hope the bit I gave helps point you in the right direction
Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
01-03-2007 10:07
alternatively:


CODE

default
{
state_entry()
{
llLinkedMessage(LINK_SET,"fireoff");
}

on_rez(integer param)
{
llResetScript();
}

touch_start(integer num)
{
state on;
}

on
{
state_entry()
{
llLinkedMessage(LINK_SET,"fireon");
}

touch_start(integer num)
{
state default;
}

on_rez(integer param)
{
llResetScript();
}
}
_____________________
My SLExchange shop

Typos are forgiven; desecrating the english language with reckless abandon and necrophilic acts is not.


The function is working perfectly fine. It's just not working the way you wanted it to work.
Perwin Rambler
Registered User
Join date: 24 Mar 2005
Posts: 152
agreed
01-03-2007 10:09
True, I do need to use states more often, would the on state really need the on_rez()?

From: Senuka Harbinger
alternatively:


CODE

default
{
state_entry()
{
llLinkedMessage(LINK_SET,"fireoff");
}

on_rez(integer param)
{
llResetScript();
}

touch_start(integer num)
{
state on;
}

on
{
state_entry()
{
llLinkedMessage(LINK_SET,"fireon");
}

touch_start(integer num)
{
state default;
}

on_rez(integer param)
{
llResetScript();
}
}
Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
01-03-2007 14:25
From: Perwin Rambler
True, I do need to use states more often, would the on state really need the on_rez()?



For my specific example: not really. since there's no variables being stored a reset script isn't truely needed anywhere, but if the person making the original inquiry added onto what I posted, then it would be a good idea to reset the object on rez in any state. An object remembers what state it was in when "De-rezzed" and there are situations where a script needs to be reset on rez no matter what state it was in when it was taken into inventory.
_____________________
My SLExchange shop

Typos are forgiven; desecrating the english language with reckless abandon and necrophilic acts is not.


The function is working perfectly fine. It's just not working the way you wanted it to work.
Farthington Whetmore
Neuros House of Fire
Join date: 18 Oct 2006
Posts: 8
01-03-2007 18:52
Thanks! I'll give it a crack :)
_____________________


"Fire Rejuvenates the Soul"
Ged Larsen
thwarted by quaternions
Join date: 4 Dec 2006
Posts: 294
01-04-2007 02:59
From: Farthington Whetmore
I seek a simple " On / Off " script that would either activate or deactivate a fire in a fireplace by just touching the object.


I contributed this script a little while ago, which should do what you want.

Sounds like you don't even want the fire to "burn out" after a set time, so you could even remove the timer if you wanted to.