DarkEmperor13 Posted March 1, 2022 Share Posted March 1, 2022 Hi I'm trying to do a unique channel listener script for my project. I've tried to look up how to do this on the wiki and even saw this post from 2 years ago but its not making any sense and im close to just scrapping my project all together cause how frustrated i am. I use llRegionSay to send message to another object. ------------------------------------------------ //This is the sender script default { touch_start(integer total_number) { integer chan = (integer)llFrand(-99)-99; llRegionSay(chan, "Change"); } } --------------------------------------------------- --------------------------------------------------- //This is the reciever script integer gListener; default { state_entry() { llListenRemove(gListener); integer chan = (integer)llFrand(-99)-99; gListener = llListen(chan, "", NULL_KEY, ""); } listen(integer ch, string nm, key id, string msg) { if(msg == "Change") { llSetTexture("rug11", ALL_SIDES); } } } --------------------------------------------------- Plz someone help and try to explain it in a way thats easy for even a noob to understand 1 Link to comment Share on other sites More sharing options...
Rolig Loon Posted March 1, 2022 Share Posted March 1, 2022 Well, that's not going to work. You have assigned a random channel in the sending script and a different random channel in the receiving script. You'd have to be really lucky to get the two to speak to each other. Unless there's a really good reason to create a random channel, just ignore that whole business. Assign the same number to chan in both scripts: integer chan = -197; or whatever. While you're at it, remove the line that says llListenRemove (gListener); from the receiving script. It's doing absolutely nothing anyway. 1 Link to comment Share on other sites More sharing options...
DarkEmperor13 Posted March 2, 2022 Author Share Posted March 2, 2022 i want it random cause what im making is something that ppl will have to have multiple of rezzed out other wise they will alol listen to the same channel Link to comment Share on other sites More sharing options...
Mollymews Posted March 2, 2022 Share Posted March 2, 2022 (edited) 38 minutes ago, DarkEmperor13 said: i want it random cause what im making is something that ppl will have to have multiple of rezzed out other wise they will alol listen to the same channel can you clarify this a bit please is it that each person has only one rezzed pair, and there can be multiple persons with one pair each ? or is that that each person can have more than one rezzed pair, and there can be multiple persons with more than one pair ? and if there are more than one rezzed pair for each person, then does each rezzed pair for each person have the same name ? edit add: example of most complex: Blue person can rezz multiple pairs of Blue pair Red person can rezz multiple pairs of Blue pair Edited March 2, 2022 by Mollymews Link to comment Share on other sites More sharing options...
sandi Mexicola Posted March 2, 2022 Share Posted March 2, 2022 You can set a "starting" channel that is a constant in the script (like -999), for all items rezzed. If a pair is rezzed, one of the scripts picks a random channel, and sends it on the starting channel (-999) to the other script. Then both scripts switch over to the random channel. 2 Link to comment Share on other sites More sharing options...
Biran Gould Posted March 2, 2022 Share Posted March 2, 2022 My go-to for a random channel number is integer channel = (integer)("0x" + (string)llGetKey()) * -1; Random for every object. Link to comment Share on other sites More sharing options...
DarkEmperor13 Posted March 2, 2022 Author Share Posted March 2, 2022 2 hours ago, Biran Gould said: My go-to for a random channel number is integer channel = (integer)("0x" + (string)llGetKey()) * -1; Random for every object. for which script? Link to comment Share on other sites More sharing options...
Profaitchikenz Haiku Posted March 2, 2022 Share Posted March 2, 2022 It will have to go in the listener script that is put into each object. Each object, when the script starts, will therefore have a channel derived from it's key, which is unique to it. The talker is going to have to do something else, it must somehow know the key of the object it is going to communicate with, and then it uses that same line of code to work out what the channel for the object must be. Link to comment Share on other sites More sharing options...
arton Rotaru Posted March 2, 2022 Share Posted March 2, 2022 (edited) Easiest might be to have the receiver write it's unique channel into it's description field on_rez. And copy/paste that number into the description field of the sender. The sender has to read it's desc field and will use that as the channel to send the messages. Edited March 2, 2022 by arton Rotaru Link to comment Share on other sites More sharing options...
DarkEmperor13 Posted March 2, 2022 Author Share Posted March 2, 2022 So that will if for instance if you are creating a panel for texture preview that rezzes an object that the textures will be applied to when you select a texture from panel? if so, can someone give me an example? Link to comment Share on other sites More sharing options...
Xiija Posted March 2, 2022 Share Posted March 2, 2022 (edited) @DarkEmperor13 mebbe use a keyword instead of a channel? that way you could use one channel ( owner based) for all coms. something kinda like ... ownerChan = 0x80000000 | (integer)("0x"+(string)llGetOwner() ); so if you send a message with a command and a target... Quote "Change | panel-1" then each prim could just parse it to see which of them will respond? listen(integer channel, string name, key id, string message) { list my_listX = llParseString2List( message,["|" ],[""] ); string chk0 = llList2String( my_listX ,0); string chk1 = llList2String( my_listX ,1); llOwnerSay("\nCommand: " + chk0 + "\nValue: " + chk1); } Quote // ownersay prints out Command: Change Value: panel-1 Edited March 2, 2022 by Xiija 1 Link to comment Share on other sites More sharing options...
DarkEmperor13 Posted March 2, 2022 Author Share Posted March 2, 2022 *brain explodes* You i wish i wasnt a visual learner. I literally have to see how a code is written in order to understand. Sighs... Link to comment Share on other sites More sharing options...
Mollymews Posted March 2, 2022 Share Posted March 2, 2022 (edited) 6 hours ago, DarkEmperor13 said: So that will if for instance if you are creating a panel for texture preview that rezzes an object that the textures will be applied to when you select a texture from panel? if so, can someone give me an example? in this case pass the channel to the rezzed object in llRezObject channel = -3456721; // change to whichever, channel can be a constant for all rezzers regardless of ownership and doesn't need to be random or obscured llRezObject(..., channel); then in the on_rez event of the object on_rez(integer channel) { // get the key of the panel that rezzed me key rezzer = llList2Key(llGetObjectDetails(llGetKey(), [OBJECT_REZZER_KEY]), 0); // set up the listener to listen only for the rezzer on the channel llListen(channel, "", rezzer, ""); } the rezzed object will only receive messages from its rezzer. As each rezzer has its own unique key (uuid) then it doesn't matter what the channel number is Edited March 2, 2022 by Mollymews typo in the on_rez code snippet 2 Link to comment Share on other sites More sharing options...
DarkEmperor13 Posted March 2, 2022 Author Share Posted March 2, 2022 Now THAT i understood! 2 Link to comment Share on other sites More sharing options...
Mollymews Posted March 2, 2022 Share Posted March 2, 2022 3 minutes ago, DarkEmperor13 said: Now THAT i understood! it helps us when you can describe the use case, rather than what is not working. As you understand what not working means when we know the use case then we more able to offer a path forward 1 Link to comment Share on other sites More sharing options...
Quistess Alpha Posted March 2, 2022 Share Posted March 2, 2022 (edited) 4 hours ago, Mollymews said: OBJECT_REZZER_KEY /me makes a mental note that this exists, and re-reads llGetObjectDetails for more goodies. . . Edit: I learned that OBJECT_SIT_COUNT also exists, which is easier to remember than taking the difference of llGetNumberOfPrims and llGetObjectPrimCount // I'm surprised OBJECT_ACCOUNT_LEVEL exists. Edited March 2, 2022 by Quistess Alpha 2 Link to comment Share on other sites More sharing options...
Lucia Nightfire Posted March 2, 2022 Share Posted March 2, 2022 27 minutes ago, Quistess Alpha said: I'm surprised OBJECT_ACCOUNT_LEVEL exists. I added it to the wiki yesterday. 😉 3 1 Link to comment Share on other sites More sharing options...
mikka Luik Posted March 3, 2022 Share Posted March 3, 2022 13 hours ago, Lucia Nightfire said: I added it to the wiki yesterday. 😉 @Lucia Nightfireoooh thats interesting. Missed that. Of course, with the constants Wiki page being changed to not have the underscore character anymore... I know there is another thread on this but was a reason ever given for all the format changes? In case its just me, running firefox 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