Jump to content

Holiday lights, light chain


Dayvana Mocha
 Share

You are about to reply to a thread that has been inactive for 2335 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hello community,

I recently built a holiday light with 5 lights on a rope for my boat. (See image).
I'm pretty new into scripting, but I made those light shine by using a remote script. The sunshade is the switch.
But this is not the way I want it.

I want to make all lights shine when I click on any of those five lights.
Obviously putting the remote script and the light script into every single lamp does not work. I tried it already.

How can I solve this?

Best,
Dayvana

 


5a24bd8972520_Bildschirmfoto2017-12-04um04_13_54.thumb.png.75817c8771c1a32e18201fccaa839240.png

Link to comment
Share on other sites

Put the script in the root prim.  That way the touch event will be activated no matter which link you touch.

And you ought to be able to light all of the lamps with that single script rather than putting a separate script in each one of them.

Write a single llSetLinkPrimitiveParams statement that aims at each one of the lamps by its link number and turns its fullbright and glow ON/OFF.

Link to comment
Share on other sites

Thank you very much for your answer.

But the root prim is assigned to the ACS Vehicle Script System. =/

Here are the scripts I'm using:

// Remote Script

integer s;
integer channel_control = 4000;
key owner;
 
 
shoutit() {
        if(s) {
            llShout(channel_control, "LAMPOFF");
            s=!s;
        }else{
            s=!s;
            llShout(channel_control, "LAMPON");
        }
}
 
default {
    state_entry() {
        owner = llGetOwner();
    }
 
    touch_start(integer num_detected) {
        if(llDetectedKey(0) == owner) {
            shoutit();
        }
        else if(llDetectedKey(0) != owner) {
            llSay(0,"You are not the Owner!");
        }
    }
 
    on_rez(integer Dae) {
        llResetScript();
    }
}
// light script

float intensity = 0.5;
float radius = 3.0;
float falloff = 0.2;
float glow = 0.2;
float alpha = 1.0;

integer light_s = TRUE;
integer channel_control = 4000;
vector lightcolor = <1.000, 0.863, 0.000>;
 
 
switchit() {
    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, 0, light_s,
        PRIM_GLOW, 0, thisglow
    ]);
}

default
{
    state_entry() {
        llListen(4000, "", NULL_KEY, "" );
    }
    
    on_rez(integer num) {
        llResetScript();
    }

    listen(integer number, string name, key id, string message) {
       
      if(message=="LAMPON") {
        switchit();
        }
      
      if(message=="LAMPOFF") {
        switchit();
        }
   }

}

 

Link to comment
Share on other sites

You should be able to combine those multiple functions into a single script and save wasteful load on the servers. Even if you don't, you should be able to drop the remote script into the root prim, unless it interferes somehow with whatever else is in the root.  The point is that unless you put the remote in the root, you won't be able to switch the lights by touching them at random, the way you want. A script with a touch event will only respond if you touch the link that it's in, unless that link is the root.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2335 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...