pixstudio Posted September 10, 2018 Share Posted September 10, 2018 hi i have a little problem with this comand..... i have created a configurator the configurator read notecard and send to hud the data (this part work because llSay show me the correct data trasfer) but when i press any button on hud i recive error and the llSay check show me only the first letter of the message this part is correct? link_message(integer sender_num, integer num, string msg, key id) { if (llGetSubString (msg, 0, 1) == "A") { //A1=message -A string A1 =(llGetSubString(msg,1,-1)); llSay(0,"A"+msg); } Link to comment Share on other sites More sharing options...
Wandering Soulstar Posted September 10, 2018 Share Posted September 10, 2018 Hi Pixstudio, Formatted your code to read a bit better, is this what you meant? link_message(integer sender_num, integer num, string msg, key id) { if (llGetSubString(msg, 0, 1) == "A") { string A1 =(llGetSubString(msg,1,-1)); llSay(0,"A"+msg); } } If that is the case not quite clear what you are trying here. the if will never read TRUE, llGetSubString(msg, 0, 1) will read in the first two characters of msg. If you only want the first it should be llGetSubString(msg, 0, 0) your llSay is just going to say the full message with an 'A' added to the front. 1 Link to comment Share on other sites More sharing options...
pixstudio Posted September 10, 2018 Author Share Posted September 10, 2018 im tryng to pass data from a card reader to an hud for texture changer the card reader work the first step of reciver lllisten work but when i push a button in the hud i recive only the first letter A i convert key A =string A1 Link to comment Share on other sites More sharing options...
Innula Zenovka Posted September 10, 2018 Share Posted September 10, 2018 This is a bit of a guessing game, since we can't see your code. but if you're sending a UUID via link message, and putting the UUID in the final, id, field of the llMessageLinked call, then link_message(integer sender, integer num, string str, key id){ llOwnerSay((string)id); } in the receiver prim will tell you what "id" is. Otherwise, please post, at least, the code you are using to send the link message and the whole of the link_message event that receives the UUID. Link to comment Share on other sites More sharing options...
pixstudio Posted September 10, 2018 Author Share Posted September 10, 2018 (edited) you are correct Innula with no specific info noone can help so for the transmiter if (llGetSubString (msg, 0, 0) == "A") { string riga00 =(llGetSubString(msg,1,-1)); llMessageLinked(LINK_THIS,-1,"A"+(string)riga00,""); llSay(0,"A"+(string)riga00); for the receiver link_message(integer sender_num, integer num, string msg, key id) { if (llGetSubString (msg, 0, 0) == "A") { llSay(0,"primocheck"+msg);//check string A1 =(llGetSubString(msg,1,-1)); key A=A1; llSay(0,"secondocheck"+A1); //check } i think the problem is relative to touch event, beacuse the two check work correctly, but when i press a button i recive error and llSay of button show me only A Edited September 10, 2018 by pixstudio Link to comment Share on other sites More sharing options...
Innula Zenovka Posted September 10, 2018 Share Posted September 10, 2018 Thanks. What code do you have inside the touch event? And when you say "i recive error and llSay of button show me only A," what does that refer to? What does the sender script say to you, and what does the receiver say? What does it say in "primocheck" and what does it say in "secondocheck"? I must say that, on the face of it, this seems an over-complicated way of doing things. As far as I can tell, the logic of your code is that if the first letter of the message in the transmitter is "A", you want to send that message to the receiver. So the only test you need, I think, is if(llGetSubString(msg,0,0)=="A"){ llMessageLinked(LINK_THIS,-1,msg,""); } There's no need to keep chopping bits off the string and then reassembling it, which is what your code seems to do, 1 Link to comment Share on other sites More sharing options...
pixstudio Posted September 12, 2018 Author Share Posted September 12, 2018 thanks Innula , i found the error , in reciver i forget to do llgetsubstring (msg,1,-1) my fault ........ but every error give a lesson to undestand and remember for improving ^ _^ another question channel used for listen have an uuid ther is a way for create integer used for channel using an iternal string , and something write in description example offset= 12 obj description = red12 ( letter string give number 0 ) integer desc = (integer) (llGetObjectDesc() ); integer ch = (desc + offset); not sure that work the final channel must be in that example 01212 Link to comment Share on other sites More sharing options...
Rolig Loon Posted September 12, 2018 Share Posted September 12, 2018 As long as the answer is logical, unique, and reproducible, you can use any scheme you like for choosing your channel number. Your only guidelines are that the channel must be an integer (preferably negative and preferably non-zero ) And it should be chosen in such a way that you can avoid crosstalk with other scripted objects in the region and can be sure that whatever is listening to a script that sends a message on that channel either knows what the channel is or is capable of finding out easily. 1 Link to comment Share on other sites More sharing options...
pixstudio Posted September 12, 2018 Author Share Posted September 12, 2018 (edited) sure Rolig uuid must be unic to avoid any crosstalk with other scripted item in region i use the example above only for an advice if is possible to use any random info for generate uuid thinking on your message , give me an idea to use owner uuid for generate uuid + a suffix in obj description adding "-" in the integer obtained in this way example integer offset = (integer) (llGetObjectDesc() ); integer ch = (integer) ("-" + llGetSubString(llGetOwner(),0,6) + offset); Edited September 12, 2018 by pixstudio Link to comment Share on other sites More sharing options...
Innula Zenovka Posted September 12, 2018 Share Posted September 12, 2018 If you want to avoid cross-talk, you might want to use this filter in the listen event: listen(integer channel, string name, key id, string message) { if(llGetOwnerKey(id)==llGetOwner()){//if whoever or whatever sent the message is my owner or belongs to my owner //then process the message } //otherwise ignore it } Link to comment Share on other sites More sharing options...
Xiija Posted September 12, 2018 Share Posted September 12, 2018 (edited) integer g_chan = 0x80000000 | (integer)("0x"+(string)llGetOwner()) ; integer offset; if( offset = (integer)llGetObjectDesc() * -1 ) { g_chan += offset; } ... or, you could hard code offsets for your projects, and keep a notecard with all the offsets for each build you have made to avoid crosstalk between scripts. Edited September 12, 2018 by Xiija Link to comment Share on other sites More sharing options...
Rolig Loon Posted September 12, 2018 Share Posted September 12, 2018 5 hours ago, pixstudio said: integer ch = (integer) ("-" + llGetSubString(llGetOwner(),0,6) + offset); That specific formula won't work, but you have the general idea. Using any UUID as the base will work, so your own UUID, or the owner's, or the key of the object itself, or the rezzer that produced it. To make it negative, you can use Xijia's suggestion, or integer g_chan = (integer) ("0xF" + llGetSubString(llGetOwner(), 0,6)); or just multiply it by -1: integer g_chan = -1 * (integer) ll llGetSubString(llGetOwner(), 0,6); Link to comment Share on other sites More sharing options...
KT Kingsley Posted September 12, 2018 Share Posted September 12, 2018 As an aside, now that some viewers allow a user to chat manually on negative channels, is there any real benefit to limiting oneself to only negative channels like this? Link to comment Share on other sites More sharing options...
Rolig Loon Posted September 12, 2018 Share Posted September 12, 2018 Less than there used to be, but since the standard LL viewer still only allows avatars to communicate on positive channels, it makes sense. Link to comment Share on other sites More sharing options...
pixstudio Posted September 13, 2018 Author Share Posted September 13, 2018 tnx for the hint 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