Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Light on and off by chat

RJ Dumart
Registered User
Join date: 10 Aug 2006
Posts: 20
02-18-2007 13:58
I guess this probably has been asked really often, but I'm seeking a script that lets the light get on by a chat command, and off again by two other chat commands (only one required to stop the light, the other as an alternative).

I'm speaking about the light in the 'features' section of the building mode. Not the "full bright" in the "texture" section.


I would be massively gratefull if someone could help this poor freelancer.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
02-18-2007 14:08
llListen
RJ Dumart
Registered User
Join date: 10 Aug 2006
Posts: 20
02-18-2007 14:12
well...I guess youre trying to help...
But, I'm no scripter. Ive tried my hand at it and I was already lost at Ben's 5th or 6th step.

So if someone would like to pass on the complete script, or professionally help me create it.
I'd be most gratefull.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
02-18-2007 14:36
First things first, an open chat, i.e. one that is not duration limited, is a REALLY BAD idea.
Thast why most lamps are touch on off where at all possible.

Here is a light script thats touch activated

heres a chat version.

CODE

float intensity = 1.0;
float radius = 10.0;
float falloff = 0.75;

vector on = <1.0,1.0,1.0>;
vector off = <0.0,0.0,0.0>;

key owner;

LightOn()
{
llSetColor(on,ALL_SIDES);

llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, on, intensity, radius, falloff
]);

}

LightOff()
{
llSetColor(off,ALL_SIDES);
llSetPrimitiveParams([PRIM_FULLBRIGHT, ALL_SIDES, FALSE,
PRIM_POINT_LIGHT, FALSE, off, intensity, radius, falloff
]);

}


default
{
state_entry()
{
owner = llGetOwner();
llListen(9,"",owner,"");
}

on_rez(integer number) { llResetScript();}

changed(integer change) { if (change & CHANGED_OWNER) llResetScript();}

listen(integer channel, string name, key id, string message)
{
string m = llToLower(message);
if (m == "on")
{
LightOn();
}
else if (m == "off")
{
LightOff();
}
}
}
RJ Dumart
Registered User
Join date: 10 Aug 2006
Posts: 20
02-18-2007 14:41
thanks alot
its for a two handed weapon. So, if you fear would be (I refer to it being 'a bad idea') letting it lit for a long duration would be bad for the sim, I can assure you there's no reason for fear. Since my weapons are holsterrable. Therefor I needed the command, so that it can be lit when it is unholsterred and automatically unlits when back into the holster.

Thanks alot. Remind me later via IM and I'll give you a free version of my MP5 -with- the light script.

Thanks again
~RJ

(EDIT: my weapons have a menu function, touching the weapon would open the menu and lit the light if it were the touch script, which would create irritation amongst my clients...)
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
02-18-2007 15:02
No its the open chat aspect thats a bad idea. Doubly so if its on channel 0.

Why not just add the light on/off to the menu?