MIVIMEX Posted June 29, 2018 Share Posted June 29, 2018 Hello! tell me please how should the script of the lighting device look like, which is switched on/off by command in the chat, and illuminates the ambience, but with only one surface glowing? Danke, Muchos gracias, Thanks! Link to comment Share on other sites More sharing options...
Fionalein Posted June 29, 2018 Share Posted June 29, 2018 see old forum posts... like this one: 1 Link to comment Share on other sites More sharing options...
Love Zhaoying Posted June 29, 2018 Share Posted June 29, 2018 The script should look like well-formatted LSL, following the best practices and examples as shown in the Wiki. I hope that helps! 1 1 Link to comment Share on other sites More sharing options...
MIVIMEX Posted July 4, 2018 Author Share Posted July 4, 2018 On 29.06.2018 at 10:48 PM, Fionalein said: see old forum posts... like this one: Hello! Thank you very much for the answer! Works great!! But what if I need the light to turn on and off on the same command, for example "light". Hello! thank you very much for the answer! works great!! but what if I need the light to turn on and off on the same command, for example light. You say "light" for the first time and the light turns on. The second time and it turns off. Link to comment Share on other sites More sharing options...
Xiija Posted July 4, 2018 Share Posted July 4, 2018 (edited) just change a few things in the script... // define a global integer toggle; // change your listen event a bit listen(integer channel, string name, key id, string message) { if ( message == "light") { toggle = !toggle // change this part ......if (message == "ON") { ..... to ... if ( toggle ) { // llParticleSystem stuff for ON } // change this part ......if (message == "OFF") { ..... to ... else { // llParticleSystem stuff for OFF } } } Edited July 4, 2018 by Xiija 1 Link to comment Share on other sites More sharing options...
PheebyKatz Posted July 7, 2018 Share Posted July 7, 2018 (edited) A global variable like integer gLit; then, in your default section, state_entry, gLit = TRUE; (or FALSE, if it is set to "off" to start with), and then in your listen event if (message == "light" && gLit) { (function you wrote to light it); } else if (message == "light" && !gLit) { (function you wrote to turn it off); } will determine if it's lit or not lit, and the same command will trigger two different things, such as turning the light on or off. Same as Xijia's, just different way to go about it. Not as elegant, but I always know what it is and what it does when I see it in a script later (like mental script commenting ). Edited July 7, 2018 by PheebyKatz 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