Wandering Soulstar Posted April 7, 2014 Share Posted April 7, 2014 Hi All, I have the followng snippet of code that I saw one day that gets me a unique chat channel: CHAN = 0x80000000 | (integer)("0x"+(string)llGetOwner()); Now I have no idea what the math is behind this, but since it is seeded by the Owner's Key, am I correct in assuming that if I were to substitute llGetKey() for llGetOwner(), I'd get a channel unquie to the prim the script is running in, always? Thanks in advance! Link to comment Share on other sites More sharing options...
ObviousAltIsObvious Posted April 7, 2014 Share Posted April 7, 2014 this kind of channel assignment makes channel collisions rare, but they can still happen. your listen event should still have all the checks it would use if everything was using the same channel. Link to comment Share on other sites More sharing options...
Wandering Soulstar Posted April 7, 2014 Author Share Posted April 7, 2014 hmmm .. when you say collisions could occur ... I am trying to keep the data transfer among prims to a minimum and was hoping that a prim with this in it would have a unique channel. I could easily have 100's of prims with this code running in them. This is for a building tool and so I want to be sure that a prim other than the one that calls the HUD does not hear a response. so ... any suggestions for how to get a unique channel id? Link to comment Share on other sites More sharing options...
Dora Gustafson Posted April 7, 2014 Share Posted April 7, 2014 Wandering Soulstar wrote: am I correct in assuming that if I were to substitute llHetKey() for llGetOwner(), I'd get a channel unquie to the prim the script is running in, always? You are right that the channel number will be based on the prim key Take notice that the prim key isn't very stable, it is new each time a new instance of the prim is rezzed Wandering Soulstar wrote: I have the followng snippet of code that I saw one day that gets me a unique chat channel: CHAN = 0x80000000 | (integer)("0x"+(string)llGetOwner()); The generated number is not unique, it is one in 2147483648 and anybody is allowed to use anyone of these channel numbers at any time The integer generated from the string uses no more than the first 8 digits from the key Two different keys that share the first 8 digits will generate the same channel number Otherwise it is not a bad way to obtain an almost unique channel number :smileysurprised::smileyvery-happy: Link to comment Share on other sites More sharing options...
Dora Gustafson Posted April 7, 2014 Share Posted April 7, 2014 Wandering Soulstar wrote: hmmm .. when you say collisions could occur ... I am trying to keep the data transfer among prims to a minimum and was hoping that a prim with this in it would have a unique channel. I could easily have 100's of prims with this code running in them. This is for a building tool and so I want to be sure that a prim other than the one that calls the HUD does not hear a response. so ... any suggestions for how to get a unique channel id? In that case you can use the same channel number for all when you call with llRegionSayTo() (You know the prim id the moment you get a request from it) :smileysurprised::smileyvery-happy: Link to comment Share on other sites More sharing options...
Wandering Soulstar Posted April 7, 2014 Author Share Posted April 7, 2014 Fantastic! Thanks Dora! 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