MannyRD Posted April 12, 2018 Share Posted April 12, 2018 (edited) Hello friends, I'm new to programming scripts. My project is to create a boat. It has been easier to write the script separately for the lights, the horn, the ignition, movement of the helix, in short, several scripts. The problem is that I want to activate them by command but, in all, I used channel 0, using the function llListen, however, by putting all the scripts in their respective prims inside my boat, it seems that the instructions are mixed making several scripts respond simultaneously, how can I make everyone listen on a different channel? best regards. Edited April 12, 2018 by MannyRD Link to comment Share on other sites More sharing options...
Fionalein Posted April 12, 2018 Share Posted April 12, 2018 (edited) short tip: don't instead use messages and keywords to communicate, and best let the user reset the cannel to some onther one, ideally your kewords are very specific to your boat like "MANNYRDBOAT1 RAISE" that way your boat will not listen to other boats =^.^= Edited April 12, 2018 by Fionalein Link to comment Share on other sites More sharing options...
Innula Zenovka Posted April 12, 2018 Share Posted April 12, 2018 Hello, Manny, and welcome to the Scripting Forum. The answer to your question is simple. In each of your scripts, you must already have a line reading something like llListen(0,"",llGetOwner(),""); (it may not be exactly that, but it will start with llListen(0 ). Simply change the 0 to some other integer value (positive if you want to be able to say them in chat rather than via a HUD), with different values in each script. Then use that channel to send commands to the particular item. In general, please don't have scripts listen on channel 0, the public chat channel, unless it's absolutely necessary. It means that every time someone on the region says something in chat, the simulator wastes resources calculating whether your scripts can hear them and, if they can, the scripts then waste further simulator resources deciding whether the messages are meant for them (which they won't be, most of the time). It's good practice to avoid having scripts that listen on 0 unless there's a good reason to use that channel and no other. Link to comment Share on other sites More sharing options...
Love Zhaoying Posted April 12, 2018 Share Posted April 12, 2018 16 minutes ago, Fionalein said: short tip: don't instead use messages and keywords to communicate, and best let the user reset the cannel to some onther one, ideally your kewords are very specific to your boat like "MANNYRDBOAT1 RAISE" that way your boat will not listen to other boats =^.^= You still need channels, unless everything is linked messages. Link to comment Share on other sites More sharing options...
Fionalein Posted April 12, 2018 Share Posted April 12, 2018 (edited) 14 minutes ago, Love Zhaoying said: You still need channels, unless everything is linked messages. I see no need for plural there, a singular channel should suffice PS: ah now I see the misunderstanding, no I didn't want to advice against using channels on boats, just against using more than one on each vehicle Edited April 12, 2018 by Fionalein 1 Link to comment Share on other sites More sharing options...
Qie Niangao Posted April 12, 2018 Share Posted April 12, 2018 Please excuse the following general suggestions, and certainly don't let them be discouraging. It's okay to start out using listen() events like this to get some practice communicating between scripts. Eventually, though, I think you'll find listen() is most appropriate for communicating between scripts in different objects, not so much for scripts in different prims of the same object, for which link_message() is more efficient, as Fionalein suggested. Also as you get more practice (and especially for vehicles that might cross sim boundaries) it's a win to minimize the number of scripts, even if fewer, larger scripts get ugly and complicated. Modularity may be prettier and easier to understand, but in LSL that comes with a real cost. Hence the appeal of llSetLinkPrimitiveParamsFast() and the various other *Link*() functions. (Unfortunately there are no link functions for sound, a shortcoming that often arises with vehicles specifically.) 2 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