MIVIMEX Posted October 7, 2018 Share Posted October 7, 2018 (edited) Hello! Help please create a script of a police siren. So far I have managed to create such a script, but for some reason it does not work. please tell me where did i make a mistake? It should turn on / off by click and blink blue / red lights. the sound is excellent, but there is a problem with the light. And when i turn it off, it gives an error : llSetPrimitiveParams error running rule #2 (PRIM_POINT_LIGHT): arg #2 is missing. Thanks for any help! //* script_starts_here // integer run; default { touch_start(integer total_number) { if(llDetectedKey(0)==llGetOwner()) { if(run) { run = FALSE; llStopSound(); llSetLinkPrimitiveParamsFast(llGetLinkNumber(),[PRIM_GLOW,ALL_SIDES,llFrand(0.10),PRIM_POINT_LIGHT,FALSE ]); } else { run = TRUE; llLoopSound("Siren", 1.0); { llSetTimerEvent(0.01); } { llSetLinkPrimitiveParamsFast(llGetLinkNumber(),[PRIM_GLOW,ALL_SIDES,llFrand(0.10),PRIM_POINT_LIGHT,TRUE, <1.0,0.0,0.0> // START COLOR ,1.0 // START INTENSITTY ,10.0 // START RADIUS ,0.2 // START FALLOFF ]); llSleep(llFrand(0.3)); llSetLinkPrimitiveParamsFast(llGetLinkNumber(),[PRIM_GLOW,ALL_SIDES,0.0,PRIM_POINT_LIGHT,TRUE, <0.0,0.0,1.0> // END COLOR ,1.0 // END INTENSITTY ,10.0 // END RADIUS ,0.2 // END FALLOFF ]); llSleep(llFrand(0.3)); } } } } } //* script_ends_here Edited October 7, 2018 by MIVIMEX Link to comment Share on other sites More sharing options...
Rolig Loon Posted October 7, 2018 Share Posted October 7, 2018 20 minutes ago, MIVIMEX said: llSetLinkPrimitiveParamsFast(llGetLinkNumber(),[PRIM_GLOW,ALL_SIDES,llFrand(0.10),PRIM_POINT_LIGHT,FALSE ]); That line is incomplete. You have forgotten to include most of the parameters for PRIM_POINT_LIGHT. You can;t just stop with FALSE. 1 1 Link to comment Share on other sites More sharing options...
MIVIMEX Posted October 7, 2018 Author Share Posted October 7, 2018 (edited) 1 hour ago, Rolig Loon said: That line is incomplete. You have forgotten to include most of the parameters for PRIM_POINT_LIGHT. You can;t just stop with FALSE. @Rolig Loon Thank you so much for your answer! Now i get no error message! Yay! but i cant make it blink... Thats what i got now: //* script_starts_here // integer run; vector COLOR_RED = <1.0, 0.0, 0.0>; vector COLOR_BLUE = <0.0, 0.0, 1.0>; default { touch_start(integer total_number) { if(llDetectedKey(0)==llGetOwner()) { if(run) { run = FALSE; llStopSound(); llSetLinkPrimitiveParamsFast(llGetLinkNumber(), [PRIM_GLOW,ALL_SIDES,FALSE,PRIM_POINT_LIGHT,FALSE, ZERO_VECTOR // COLOR ,0.0 // INTENSITTY ,0.0 // RADIUS ,1 // FALLOFF ]); } else { run = TRUE; llLoopSound("Siren", 1.0); { llSetTimerEvent(0.01); } { llSetLinkPrimitiveParamsFast(llGetLinkNumber(),[PRIM_GLOW,ALL_SIDES,llFrand(0.10),PRIM_POINT_LIGHT,TRUE, COLOR_RED // START COLOR ,1.0 // START INTENSITTY ,10.0 // START RADIUS ,0.2 // START FALLOFF ]); llSleep(llFrand(0.1)); llSetLinkPrimitiveParamsFast(llGetLinkNumber(),[PRIM_GLOW,ALL_SIDES,0.10,PRIM_POINT_LIGHT,TRUE, COLOR_BLUE // END COLOR ,1.0 // END INTENSITTY ,10.0 // END RADIUS ,0.2 // END FALLOFF ]); llSleep(llFrand(0.1)); } } } } } //* script_ends_here Edited October 7, 2018 by MIVIMEX Link to comment Share on other sites More sharing options...
Rolig Loon Posted October 7, 2018 Share Posted October 7, 2018 That would probably be because you started your incredibly fast timer event with llSetTimerEvent(0.01) but you forgot to write one. If you write a timer event, put those SLPPF calls in it, and get rid of the llSleep statements, it will probably work. 1 Link to comment Share on other sites More sharing options...
MIVIMEX Posted October 7, 2018 Author Share Posted October 7, 2018 9 minutes ago, Rolig Loon said: That would probably be because you started your incredibly fast timer event with llSetTimerEvent(0.01) but you forgot to write one. If you write a timer event, put those SLPPF calls in it, and get rid of the llSleep statements, it will probably work. @Rolig Loon Thank you very much for your help! I now have a syntax error (Line 34). Maybe i placed timer in wrong place? And do i need these llFrand(0.1); ? (I do not quite understand why they are here). //* script_starts_here // integer run; vector COLOR_RED = <1.0, 0.0, 0.0>; vector COLOR_BLUE = <0.0, 0.0, 1.0>; default { touch_start(integer total_number) { if(llDetectedKey(0)==llGetOwner()) { if(run) { run = FALSE; llStopSound(); llSetLinkPrimitiveParamsFast(llGetLinkNumber(), [PRIM_GLOW,ALL_SIDES,FALSE,PRIM_POINT_LIGHT,FALSE, ZERO_VECTOR // COLOR ,0.0 // INTENSITY ,0.0 // RADIUS ,1 // FALLOFF ]); } else { run = TRUE; {llLoopSound("Siren", 1.0);} timer() { llSetTimerEvent(0.1); } { llSetLinkPrimitiveParamsFast(llGetLinkNumber(),[PRIM_GLOW,ALL_SIDES,llFrand(0.1),PRIM_POINT_LIGHT,TRUE, COLOR_RED // START COLOR ,1.0 // START INTENSITY ,10.0 // START RADIUS ,0.2 // START FALLOFF ]); llFrand(0.1); llSetLinkPrimitiveParamsFast(llGetLinkNumber(),[PRIM_GLOW,ALL_SIDES,0.10,PRIM_POINT_LIGHT,TRUE, COLOR_BLUE // END COLOR ,1.0 // END INTENSITY ,10.0 // END RADIUS ,0.2 // END FALLOFF ]); llFrand(0.1); } } } } } //* script_ends_here Link to comment Share on other sites More sharing options...
Rolig Loon Posted October 7, 2018 Share Posted October 7, 2018 2 minutes ago, MIVIMEX said: And do i need these llFrand(0.1); ? (I do not quite understand why they are here). They are incomplete statements. I have no idea why you wrote them either. And yes. you placed the timer event in the wrong place. You placed it inside the touch_start event. You can't do that. Each event in a LSL script is separate. It will be easier to read your script and recognize errors like these if you use indentations and white space to format things so that you can see clearly where blocks of code begin and end. 1 Link to comment Share on other sites More sharing options...
MIVIMEX Posted October 7, 2018 Author Share Posted October 7, 2018 46 minutes ago, Rolig Loon said: They are incomplete statements. I have no idea why you wrote them either. And yes. you placed the timer event in the wrong place. You placed it inside the touch_start event. You can't do that. Each event in a LSL script is separate. It will be easier to read your script and recognize errors like these if you use indentations and white space to format things so that you can see clearly where blocks of code begin and end. @Rolig Loon Thanks! I moved the timer down. No error messages. but now it glows all the time and does not blink //* script_starts_here // integer run; vector COLOR_RED = <1.0, 0.0, 0.0>; vector COLOR_BLUE = <0.0, 0.0, 1.0>; default { touch_start(integer total_number) { if(llDetectedKey(0)==llGetOwner()) { if(run) { run = FALSE; llStopSound(); llSetLinkPrimitiveParamsFast(llGetLinkNumber(), [PRIM_GLOW,ALL_SIDES,FALSE,PRIM_POINT_LIGHT,FALSE, ZERO_VECTOR // COLOR ,0.0 // INTENSITY ,0.0 // RADIUS ,1 // FALLOFF ]); } else { run = TRUE; llLoopSound("Siren", 1.0); llSetTimerEvent(0.1); } } } timer() { llSetLinkPrimitiveParamsFast(llGetLinkNumber(),[PRIM_GLOW,ALL_SIDES,1,PRIM_POINT_LIGHT,TRUE, COLOR_RED // START COLOR ,1.0 // START INTENSITY ,10.0 // START RADIUS ,0.2 // START FALLOFF ]); llSetLinkPrimitiveParamsFast(llGetLinkNumber(),[PRIM_GLOW,ALL_SIDES,1,PRIM_POINT_LIGHT,TRUE, COLOR_BLUE // END COLOR ,1.0 // END INTENSITY ,10.0 // END RADIUS ,0.2 // END FALLOFF ]); } } //* script_ends_here Link to comment Share on other sites More sharing options...
Xiija Posted October 7, 2018 Share Posted October 7, 2018 (edited) You can prettify your code here... https://beautifier.io/ //* script_starts_here // integer run; vector COLOR_RED = < 1.0, 0.0, 0.0 > ; vector COLOR_BLUE = < 0.0, 0.0, 1.0 > ; integer x; default { touch_start(integer total_number) { if (llDetectedKey(0) == llGetOwner()) { if (run) { run = FALSE; llStopSound(); llSetLinkPrimitiveParamsFast(llGetLinkNumber(), [PRIM_GLOW, ALL_SIDES, FALSE, PRIM_POINT_LIGHT, FALSE, ZERO_VECTOR // COLOR , 0.0 // INTENSITY , 0.0 // RADIUS , 1 // FALLOFF ]); } else { run = TRUE; llLoopSound("Siren", 1.0); llSetTimerEvent(0.2); } } } timer() { x = !x; // ***** added varible X to toggle between blinks ***** if(x) { llSetLinkPrimitiveParamsFast(llGetLinkNumber(), [PRIM_GLOW, ALL_SIDES, 1, PRIM_POINT_LIGHT, TRUE, COLOR_RED // START COLOR , 1.0 // START INTENSITY , 10.0 // START RADIUS , 0.2 // START FALLOFF ]); } else { llSetLinkPrimitiveParamsFast(llGetLinkNumber(), [PRIM_GLOW, ALL_SIDES, 1, PRIM_POINT_LIGHT, TRUE, COLOR_BLUE // END COLOR , 1.0 // END INTENSITY , 10.0 // END RADIUS , 0.2 // END FALLOFF ]); } } } //* script_ends_here Edited October 7, 2018 by Xiija 1 Link to comment Share on other sites More sharing options...
MIVIMEX Posted October 7, 2018 Author Share Posted October 7, 2018 (edited) @Xiija @Rolig Loon Thank you! But now it does not stop blinking and glow all the time. the sound is turned on/off normally. help please! Edited October 7, 2018 by MIVIMEX Link to comment Share on other sites More sharing options...
Rolig Loon Posted October 7, 2018 Share Posted October 7, 2018 Think this through logically .... The blinking is handled by the timer event, so how do you stop the blinking? .... Turn off the timer. You turned it ON in the touch_start event. See if you can figure out where you should have llSetTimerEvent(0.0). 1 Link to comment Share on other sites More sharing options...
MIVIMEX Posted October 7, 2018 Author Share Posted October 7, 2018 21 minutes ago, Rolig Loon said: Think this through logically .... The blinking is handled by the timer event, so how do you stop the blinking? .... Turn off the timer. You turned it ON in the touch_start event. See if you can figure out where you should have llSetTimerEvent(0.0). 4 hours ago, Xiija said: You can prettify your code here... https://beautifier.io/ @Rolig Loon @Xiija Thank you very much! It works like magic! I just placed llSetTimerEvent(0.0) inside the touch_start event. THANK YOU!!! 1 Link to comment Share on other sites More sharing options...
MIVIMEX Posted October 7, 2018 Author Share Posted October 7, 2018 (edited) This is what the script looks like at the moment. however, it was not possible to make its GLOW blink. maybe this is not possible? In general, if someone complements I will be very grateful. //* script_starts_here // integer run; vector COLOR_RED = < 1.0, 0.0, 0.0 > ; vector COLOR_BLUE = < 0.0, 0.0, 1.0 > ; integer x; default { touch_start(integer total_number) { if (llDetectedKey(0) == llGetOwner()) { if (run) { run = FALSE; llStopSound(); llSetTimerEvent(0.0); llSetLinkPrimitiveParamsFast(llGetLinkNumber(), [PRIM_GLOW, ALL_SIDES, FALSE, PRIM_POINT_LIGHT, FALSE, ZERO_VECTOR // COLOR , 0.0 // INTENSITY , 0.0 // RADIUS , 1 // FALLOFF ]); } else { run = TRUE; llLoopSound("Siren", 1.0); llSetTimerEvent(0.2); } } } timer() { x = !x; // ***** added varible X to toggle between blinks ***** if(x) { llSetLinkPrimitiveParamsFast(llGetLinkNumber(), [PRIM_GLOW, 2, 1, PRIM_POINT_LIGHT, TRUE, COLOR_RED // START COLOR , 1.0 // START INTENSITY , 10.0 // START RADIUS , 0.2 // START FALLOFF ]); } else { llSetLinkPrimitiveParamsFast(llGetLinkNumber(), [PRIM_GLOW, 4, 1, PRIM_POINT_LIGHT, TRUE, COLOR_BLUE // END COLOR , 1.0 // END INTENSITY , 10.0 // END RADIUS , 0.2 // END FALLOFF ]); } } } //* script_ends_here Edited October 7, 2018 by MIVIMEX Link to comment Share on other sites More sharing options...
Fluffy Sharkfin Posted October 7, 2018 Share Posted October 7, 2018 To make the glow on each face blink on and off with the light you need to add an extra line to your llSetLinkPrimitiveParamsFast commands that turns off the glow for the opposite face... if(x) { llSetLinkPrimitiveParamsFast(llGetLinkNumber(), [PRIM_GLOW, 2, 1, PRIM_POINT_LIGHT, TRUE, COLOR_RED // START COLOR , 1.0 // START INTENSITY , 10.0 // START RADIUS , 0.2 // START FALLOFF , PRIM_GLOW, 4, 0 // Turn off GLOW on opposite face ]); } else { llSetLinkPrimitiveParamsFast(llGetLinkNumber(), [PRIM_GLOW, 4, 1, PRIM_POINT_LIGHT, TRUE, COLOR_BLUE // END COLOR , 1.0 // END INTENSITY , 10.0 // END RADIUS , 0.2 // END FALLOFF , PRIM_GLOW, 2, 0 // Turn off GLOW on opposite face ]); also you may be better off using the constant LINK_THIS rather than llGetLinkNumber(). 1 Link to comment Share on other sites More sharing options...
MIVIMEX Posted October 8, 2018 Author Share Posted October 8, 2018 9 hours ago, Fluffy Sharkfin said: To make the glow on each face blink on and off with the light you need to add an extra line to your llSetLinkPrimitiveParamsFast commands that turns off the glow for the opposite face... @Fluffy Sharkfin Thank you! Now the script is absolutely perfect!Thanks again to all the people whose great efforts have created this script: @Rolig Loon @Xiija @Fluffy Sharkfin Link to comment Share on other sites More sharing options...
Recommended Posts
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