Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Linking to a Touch Light Script

Dragger Lok
(loading ...)
Join date: 10 Sep 2006
Posts: 228
03-30-2007 15:58
Have a simple touch light script- touch on and it illuminates an area (turns light on) also turns full bright on and off- I'd like to link it to a script that just turns full bright on and off along with it- will gladly pay to have someone take the time to help me out, if not a nudge in the right direction...

PHP Code:
default
{
state_entry()
{
llSetPrimitiveParams([PRIM_POINT_LIGHT, FALSE, <1, 1, 1>, 1.0, 10.0, 0.75]);
llSetPrimitiveParams([PRIM_FULLBRIGHT, ALL_SIDES, FALSE]);
}

touch_start(integer num)
{
state on;
}
}


oops...think i need help posting scripts too

state on
{
state_entry()
{
llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, <1, 1, 1>, 1.0, 10.0, 0.75]);
llSetPrimitiveParams([PRIM_FULLBRIGHT, ALL_SIDES, TRUE]);
}

touch_start(integer num)
{
state default;
}
}
AJ DaSilva
woz ere
Join date: 15 Jun 2005
Posts: 1,993
03-31-2007 04:20
The code you posted works, but would be marginally quicker like this:
CODE
default
{
state_entry()
{
llSetPrimitiveParams([PRIM_POINT_LIGHT, FALSE, <1, 1, 1>, 1.0, 10.0, 0.75,PRIM_FULLBRIGHT, ALL_SIDES, FALSE]);
}

touch_start(integer num)
{
state on;
}
}

state on
{
state_entry()
{
llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, <1, 1, 1>, 1.0, 10.0, 0.75,PRIM_FULLBRIGHT, ALL_SIDES, TRUE]);
}

touch_start(integer num)
{
state default;
}
}


You can find all the info about things like putting code in PHP boxouts here. :)
Dragger Lok
(loading ...)
Join date: 10 Sep 2006
Posts: 228
Thanks-
03-31-2007 04:56
thanks for the reply and the code but i need to link that script to another one to change a second prim to full bright an off again...
AJ DaSilva
woz ere
Join date: 15 Jun 2005
Posts: 1,993
03-31-2007 05:38
Oddly, setting something as a light seems to alter it's texture as well. It might be possible to compensate for it, but I can't find anything on how it works.
CODE
default
{
state_entry()
{
llMessageLinked(LINK_SET, 0, "", NULL_KEY);
llSetPrimitiveParams([PRIM_POINT_LIGHT, FALSE, <1, 1, 1>, 1.0, 10.0, 0.75,PRIM_FULLBRIGHT, ALL_SIDES, FALSE]);
}

touch_start(integer num)
{
state on;
}
}

state on
{
state_entry()
{
llMessageLinked(LINK_SET, 1, "", NULL_KEY);
llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, <1, 1, 1>, 1.0, 10.0, 0.75,PRIM_FULLBRIGHT, ALL_SIDES, TRUE]);

}

touch_start(integer num)
{
state default;
}
}

CODE
default
{

state_entry()
{
llSetPrimitiveParams([PRIM_FULLBRIGHT, ALL_SIDES, FALSE]);
}

link_message(integer sender_num, integer num, string str, key id)
{
if(num)
{
llOwnerSay("on");
state on;
}
}
}

state on
{
state_entry()
{
llSetPrimitiveParams([PRIM_FULLBRIGHT, ALL_SIDES, TRUE]);
}

link_message(integer sender_num, integer num, string str, key id)
{
if(!num)
state default;
}
}