MrBobbins Posted November 11, 2015 Share Posted November 11, 2015 Hi everyone, I'm learning some functions for a project, I'm making some progress. I wanted to utilise a script available on wiki to serve some other functions with prims in a linkset. The script I have is as follows: vector BLUE = <0.000, 0.455, 0.851>; vector AQUA = <0.498, 0.859, 1.000>; vector TEAL = <0.224, 0.800, 0.800>; vector OLIVE = <0.239, 0.600, 0.439>; vector GREEN = <0.180, 0.800, 0.251>; vector LIME = <0.004, 1.000, 0.439>; vector YELLOW = <1.000, 0.863, 0.000>; vector ORANGE = <1.000, 0.522, 0.106>; vector RED = <1.000, 0.255, 0.212>; vector MAROON = <0.522, 0.078, 0.294>; vector FUSCHIA = <0.941, 0.071, 0.745>; vector PURPLE = <0.694, 0.051, 0.788>; vector WHITE = <1.000, 1.000, 1.000>; vector SILVER = <0.867, 0.867, 0.867>; vector GRAY = <0.667, 0.667, 0.667>; vector DARKGRAY =<0.255, 0.255, 0.255>; vector BLACK = <0.00, 0.00, 0.00>; float red=1.0; float green=0.0; float blue=0.0; vector startColor = <red, green, blue>; vector endColor = <red, green, blue>; default { state_entry() { llListen(10, "", "", ""); llSetLinkPrimitiveParamsFast(LINK_ROOT, [ PRIM_COLOR, ALL_SIDES, BLACK, 1.0, PRIM_POINT_LIGHT, FALSE, WHITE, 1.0, 10.0, 0.6]); } on_rez(integer message) { llResetScript(); } listen(integer channel, string name, key id, string message) { if(message == "rainbow") { llSetTimerEvent(0.2); } } timer() { if(red >= 1.0) { if (blue > 0.1) {blue = blue - 0.1;} else {green = green + 0.1;} } if(green >= 1.0) { if (red > 0.1) {red = red - 0.1;} else {blue = blue + 0.1;} } if(blue >= 1.0) { if (green > 0.1) {green = green - 0.1;} else {red = red + 0.1;} } startColor = <red, green, blue>; endColor = <red, green, blue>; llSetPrimitiveParams([PRIM_POINT_LIGHT,TRUE, <red,green,blue>, // light color vector range: 0.0-1.0 *3 1.0, // intensity (0.0-1.0) 20.0, // radius (.1-10.0) 1.0 ]); // falloff (.01-1.0) llSetLinkColor(LINK_ALL_CHILDREN, <red,green,blue>, ALL_SIDES); llSetTimerEvent(0.2); } } if(message == "test") { llSetLinkPrimitiveParamsFast(LINK_ROOT, [ PRIM_POINT_LIGHT, TRUE, WHITE, 1.0, 10.0, 0.6, PRIM_LINK_TARGET, 4, PRIM_COLOR, ALL_SIDES, WHITE, 1.0, PRIM_FULLBRIGHT, ALL_SIDES, TRUE, PRIM_GLOW, ALL_SIDES, 0.0]); } }Now the Vectors at the top with colours in CAPS is from a previous experiment I plan to use later on in this script. But the problem I am having is creating another 'if(message == "test")', I get syntax errors all over the place. And I looked and scraped, and wildcarded my script with brackets, and I just can't find it. If someone can help me, or explain a wee bit why its not working, I;d really appreciate it. Thank you \o/ Link to comment Share on other sites More sharing options...
Rolig Loon Posted November 12, 2015 Share Posted November 12, 2015 It looks to me as if you intended to put that last test in the listen event. After all, that's the only place that it will see a variable named "message" to test. Right now, you have it hanging at the bottom of the script, not in any event. Just make it into an else if, and move it up to the listen event. Link to comment Share on other sites More sharing options...
MrBobbins Posted November 12, 2015 Author Share Posted November 12, 2015 Hi Rolig, thanks for your reply, I tried what you said and get a Syntax error on the changed 'else if'. I know am missing something somewhere, been staring at it so long I forget what is where.. argh. Link to comment Share on other sites More sharing options...
Rolig Loon Posted November 12, 2015 Share Posted November 12, 2015 listen(integer channel, string name, key id, string message){ if(message == "rainbow") { llSetTimerEvent(0.2); } else if(message == "test") { llSetLinkPrimitiveParamsFast(LINK_ROOT, [ PRIM_POINT_LIGHT, TRUE, WHITE, 1.0, 10.0, 0.6, PRIM_LINK_TARGET, 4, PRIM_COLOR, ALL_SIDES, WHITE, 1.0, PRIM_FULLBRIGHT, ALL_SIDES, TRUE, PRIM_GLOW, ALL_SIDES, 0.0]); } } Link to comment Share on other sites More sharing options...
Xiija Posted November 12, 2015 Share Posted November 12, 2015 vector BLUE = <0.000, 0.455, 0.851>; vector AQUA = <0.498, 0.859, 1.000>; vector TEAL = <0.224, 0.800, 0.800>; vector OLIVE = <0.239, 0.600, 0.439>; vector GREEN = <0.180, 0.800, 0.251>; vector LIME = <0.004, 1.000, 0.439>; vector YELLOW = <1.000, 0.863, 0.000>; vector ORANGE = <1.000, 0.522, 0.106>; vector RED = <1.000, 0.255, 0.212>; vector MAROON = <0.522, 0.078, 0.294>; vector FUSCHIA = <0.941, 0.071, 0.745>; vector PURPLE = <0.694, 0.051, 0.788>; vector WHITE = <1.000, 1.000, 1.000>; vector SILVER = <0.867, 0.867, 0.867>; vector GRAY = <0.667, 0.667, 0.667>; vector DARKGRAY =<0.255, 0.255, 0.255>; vector BLACK = <0.00, 0.00, 0.00>; float red=1.0; float green=0.0; float blue=0.0; vector startColor = <red, green, blue>; vector endColor = <red, green, blue>; default { state_entry() { llListen(10, "", "", ""); llSetLinkPrimitiveParamsFast(LINK_ROOT, [ PRIM_COLOR, ALL_SIDES, BLACK, 1.0, PRIM_POINT_LIGHT, FALSE, WHITE, 1.0, 10.0, 0.6]); } on_rez(integer message) { llResetScript(); } listen(integer channel, string name, key id, string message) { if(message == "rainbow") { llSetTimerEvent(0.2); } else if(message == "test") { llSetTimerEvent(0.0); llSetLinkPrimitiveParamsFast(LINK_ROOT, [ PRIM_POINT_LIGHT, TRUE, WHITE, 1.0, 10.0, 0.6, PRIM_LINK_TARGET, 4, PRIM_COLOR, ALL_SIDES, WHITE, 1.0, PRIM_FULLBRIGHT, ALL_SIDES, TRUE, PRIM_GLOW, ALL_SIDES, 0.0 ]); } } timer() { if(red >= 1.0) { if (blue > 0.1) {blue = blue - 0.1;} else {green = green + 0.1;} } if(green >= 1.0) { if (red > 0.1) {red = red - 0.1;} else {blue = blue + 0.1;} } if(blue >= 1.0) { if (green > 0.1) {green = green - 0.1;} else {red = red + 0.1;} } startColor = <red, green, blue>; endColor = <red, green, blue>; llSetPrimitiveParams([PRIM_POINT_LIGHT,TRUE, <red,green,blue>, // light color vector range: 0.0-1.0 *3 1.0, // intensity (0.0-1.0) 20.0, // radius (.1-10.0) 1.0 ]); // falloff (.01-1.0) llSetLinkColor(LINK_ALL_CHILDREN, <red,green,blue>, ALL_SIDES); } } Link to comment Share on other sites More sharing options...
MrBobbins Posted December 14, 2015 Author Share Posted December 14, 2015 Many thanks for the help, overlooking the script with tired eyes hadn;t helped me. Sorry for delay in thanking you guys, illness swept the household and we all suffered haha. Project is going amazingly well, with many thanks for your help. I really do appreciate it. 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