Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Full bright with proximity?

Weston Graves
Werebeagle
Join date: 24 Mar 2007
Posts: 2,059
12-20-2008 18:52
I am in SL for fun - and scripting isn't fun. Still there are times when you need to do it or have it done.

What I need should be fairly simple. In an outdoor display, I need a sign to toggle to full bright if an avatar approaches within say 10 meters, and then shut off again after they leave. Alternately I could have them touch the sign to turn on full bright and it only stays on a few minutes.

This will allow signs to be read at night without the ugly full bright disturbing neighbors much.

Has anyone done this already, or is this something I should comission someone to write? I know it's probably beneath most scriptors skill level. Maybe it's just barely within my skill and patience level.

Would this be the same kind of script that toggles local lighting on an off?
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-20-2008 20:26
you could look for a streetlamp type script (there are light scripts too) that auto toggles for SL 'night'

the other methods either require polling (sensors) or invisible volume detect pads (triggers when someone is inside it. the first should be available as a greeter script, the second should be available as an automatic door, both on the forums here
_____________________
|
| . "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...
| -
Myhrrhleine Wingtips
Registered User
Join date: 10 Mar 2008
Posts: 29
12-20-2008 20:47
Are you looking for something like this?

CODE

default
{
state_entry()
{
//Scan area for avatars within 10m every 5 seconds
llSensorRepeat("","",AGENT,10,PI,5);
}
sensor(integer total_number)
{
llSetPrimitiveParams([PRIM_FULLBRIGHT,ALL_SIDES,TRUE]);//Full Bright on

llSetTimerEvent(60.0);//Start the timer
}

timer()
{
llSetPrimitiveParams([PRIM_FULLBRIGHT,ALL_SIDES,FALSE]);//Full Bright off


llSetTimerEvent(0); //stop the timer

}
}

Weston Graves
Werebeagle
Join date: 24 Mar 2007
Posts: 2,059
12-20-2008 23:05
From: Myhrrhleine Wingtips
Are you looking for something like this?

CODE

default
{
state_entry()
{
//Scan area for avatars within 10m every 5 seconds
llSensorRepeat("","",AGENT,10,PI,5);
}
sensor(integer total_number)
{
llSetPrimitiveParams([PRIM_FULLBRIGHT,ALL_SIDES,TRUE]);//Full Bright on

llSetTimerEvent(60.0);//Start the timer
}

timer()
{
llSetPrimitiveParams([PRIM_FULLBRIGHT,ALL_SIDES,FALSE]);//Full Bright off


llSetTimerEvent(0); //stop the timer

}
}



Yes, I'm looking for something exactly like that. . . except, it shouldn't be shorter than my description of it, should it? You scripting people are total magicians to me.

This works perfectly. THANK YOU!
Ron Khondji
Entirely unlike.
Join date: 6 Jan 2007
Posts: 224
Automatic day/night, off/on.
12-21-2008 00:58
Or You can do it like this:

CODE


light(integer power)
{
llSetPrimitiveParams([PRIM_FULLBRIGHT,ALL_SIDES,power]);
}

default
{
state_entry()
{
llSetTimerEvent(150.0); // time between 'sun position checks' in seconds (2,5 min)
}

timer()
{
vector sun = llGetSunDirection();
if (sun.z <= 0) light(1); // sun below horizon = night = light on.
else light(0); // sun above horizon = day = light off.
}
}



This checks the sun's position every 2.5 minutes and if the sun is below the horizon sets the texture to full_bright and back if the sun comes up.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-21-2008 04:41
oh I suppose I'll do the volume detection version.... least impact because it uses passive detection, though it does make the object phantom

CODE

// integer gIntCounter;

default(){
state_entry(){
llVolumeDetect( TRUE );
}

collision_start( integer vIntCrowd ){
// gIntCounter += (1 + vIntCrowd);
llSetPrimitiveParams( [PRIM_FULLBRIGHT, ALL_SIDES, TRUE] );
}

collision_end( integer vIntTest ){
// gIntCounter -= (1 + vIntCrowd);
// if (!vIntCounter){
llSetPrimitiveParams( [PRIM_FULLBRIGHT, ALL_SIDES, FALSE] );
// }
}
}

needs a big invisible child prim around it, may also need the counter, since I'm not sure if collision end is triggered when one of multiple avs leaves the area (try it without the commented parts first)

PS, llSensorRepeat can occasionally pick up av's outside of it's detection range, so if you're going to use a timer anyways, llSensor would be a safer bet, with the fullbright command in the sensor and no_sensor events. otherwise ditch the timer.
_____________________
|
| . "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...
| -
Myhrrhleine Wingtips
Registered User
Join date: 10 Mar 2008
Posts: 29
12-22-2008 20:57
From: Void Singer


PS, llSensorRepeat can occasionally pick up av's outside of it's detection range, so if you're going to use a timer anyways, llSensor would be a safer bet, with the fullbright command in the sensor and no_sensor events. otherwise ditch the timer.



Good point, I had forgotten about that. I usually do on demand sensor sweeps instead of repeating ones so I rarely encounter this problem.