Jump to content
Sign in to follow this  
Pamela Galli

Light script

Recommended Posts

Apparently, for the third time, my light script has stopped working. Twice before I had to replace my light scripts because they just stopped. I have several hundred light fixtures with light scripts. 

 

Has anyone else noticed a sudden change in lights turning on/off?

Share this post


Link to post
Share on other sites

No, but if your lights are point source lights -- that it, objects that make the area around themselves brighter, as opposed to objects that have FULL_BRIGHT or Glow on them -- then you will never be able to see more than six of them at a time.  There's an OpenGL limit of 8 local light sources, of which the sun and SL's ambient light are two.  Which six you see at any given time depends on how close they are to you, how large they are, and how bright.  If you suddenly have a new, bright light source in the area, it can overwhelm other lights and make them turn off.  That's what happens, for example, when a half dozen newbies with heavy face lights enter a dance floor.

Now, if that's not the issue, but you're talking about an actual failure of the scripted "toggle switch" that turns the light on and off, I don't have a clue why a whole flock of them would fail at once. 

Share this post


Link to post
Share on other sites

Aha! I found your earlier post on this same question, and discovered that Innula gave you essentially the same answer I did --- even referencing Kitty Barnett,s old forum post  (which is very cool, BTW). So I apologize for telling you stuff you already know, and giving you an answer that may be irrelevant. It's still possible, though, that you have been using the new Lighting option that's been available in the last few viewer updates, and have accidentally turned it off.  That option does let you see more than just 6 local light sources, but not if you have it turned off or have lowered your graphics quality slider from Ultra.

Share this post


Link to post
Share on other sites


Rolig Loon wrote:

It's still possible, though, that you have been using the new Lighting option that's been available in the last few viewer updates, and have accidentally turned it off.  That option does let you see more than just 6 local light sources, but not if you have it turned off or have lowered your graphics quality slider from Ultra.

Right:)

  • The number of point lights is much bigger when Lighting and Shadows is checked in PREFERENCES/Graphics in the viewer
  • How big is unknown, but the viewer will easily render 144 projector light beams

See PRIM_POINT_LIGHT

Share this post


Link to post
Share on other sites

I have not seen this, nor other reports of it, but I can imagine that light changes might be among the things that sometimes fail to generate updates to the viewer in current sim releases. If that's the case, the giveaway would be if it corrects itself with a right-click to select the object -- and a jira would be in order. (And a possible workaround would be some invisible llSetText() kludgery.)

Share this post


Link to post
Share on other sites

Thanks for the help everyone, found the problem! I turned on Lighting and Shadows and WHOA it was like I was on the sun!

I made sure all lights were off, no change. But then I discovered I had accidentally put lighting in a chandelier chain, then made three chains per chandelier, three chandeliers. Gaaah!

So all is well now. 

Share this post


Link to post
Share on other sites

Hello

I'd like to know if someone could help me with a light script.

I made a lamp which has 3 faces and i'd like to light up the face 0 .

I have a script to light my lamp up BUT all the faces are on light and i see no place into the script to select which face i want to light up.

Someone know how to add this into the script ? and also if that was possible to add an access to the lamp like owner or public ...

Thanks for your replies :)

 

// Touch the object to light it up.
// Lighting is configurable.
 
integer light_s    = TRUE;
vector  lightcolor = <1.0, 0.75, 0.5>;
float   intensity  = 1.0;             // 0.0 <= intensity <= 1.0
float   radius     = 10.0;            // 0.1 <= radius <= 20.0
float   falloff    = 0.01;            // 0.01 <= falloff <= 2.0
float   glow       = 0.05;
 
toggle()
{
    float thisglow = 0.0;
    light_s = !light_s;
 
    if (light_s)
        thisglow = glow;
 
    llSetPrimitiveParams([
        PRIM_POINT_LIGHT, light_s, lightcolor, intensity, radius, falloff,
        PRIM_FULLBRIGHT, ALL_SIDES, light_s,
        PRIM_GLOW,       ALL_SIDES, thisglow
    ]);
      llSetColor(lightcolor, ALL_SIDES);
}
 
default
{
    state_entry()
    {
        llSetText("", <1.0, 1.0, 1.0>, 1.0);
        toggle();
    }
 
    touch_start(integer total_number)
    {
        toggle();
    }
}

Share this post


Link to post
Share on other sites

Add a list like this to the very top of the script. It will contain avatar UUID keys - you need to customize it for your needs, of course, and delete/replace this example data. You don't need to add the object owner.

list accessList = ["key 1", "key 2", "key 3", "10000000-2000-3000-4000-500000000000", "key 5 etc"];

Replace the touch_start() event with this:

    touch_start(integer total_number)
    {
        key targetAvatar = llDetectedKey(0);
        if (targetAvatar == llGetOwner() || ~llListFindList(accessList, (list)((string)targetAvatar)))
        {
            toggle();
        }
        else
        {
            if (llGetAgentSize(targetAvatar) != ZERO_VECTOR)
            {
                llRegionSayTo(targetAvatar, 0, "You are not on the access list.");
            }
            else
            {
                llInstantMessage(targetAvatar, "You are not on the access list.");
            }
        }
    }

 

  • Like 1

Share this post


Link to post
Share on other sites
7 hours ago, LAHIN Milo said:

Hello

I'd like to know if someone could help me with a light script.

I made a lamp which has 3 faces and i'd like to light up the face 0 .

This probably should have been asked in its own post instead of necroposting here, heh.

  • Like 1

Share this post


Link to post
Share on other sites

Thank you @panterapolnocy for your help !

I was thinking about to link each lamps together and then when you click on any of them all the lamps turns on ..🤔

I tried to find a way to do this on google but i didnt find it :(

Sorry @Lucia Nightfire i didnt find the same problem as me in this topic thats why i didnt started a new topic cause this one was talkin about light script .

Share this post


Link to post
Share on other sites

Replace these lines:

llSetPrimitiveParams([
llSetColor(lightcolor, 0);

with these:

llSetLinkPrimitiveParamsFast(LINK_SET, [
llSetLinkColor(LINK_SET, lightcolor, 0);

and check the results.

  • Thanks 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...