nycbard Posted November 8, 2011 Share Posted November 8, 2011 Hi, i made an on-ine statue indicator for staff boards. The staff board works correctly, displaying the staff member's profile image and their on-ine status.My issue is that during a one of my (if..else) loops, I am not having communication. The ROOT prim/script should be sending a number (either a 1 or a 0) to a CHILD prim/script. When the message is recieved a texture is changed. dataserver(key queryid, string data) { if ( data == "1" ) { status = " is online"; llSetText(name + status, <0,1,0>, 1.0); llMessageLinked(integer LINK_SET, integer 1, "", ""); } else if (data == "0") { status = " is offline"; llSetText(name + status, <1,0,0>, 1.0); llMessageLinked(integer LINK_SET, integer 0, "", ""); } That is the code of the dataserver in the ROOT prim/scriptdefault { state_entry() { link_message(integer sender_number, integer number, string message, key id) { if ( sender_number == "1" ){ fliptexture(AVAILABLE); } else if ( sender_number == "0"){ fliptexture(UNAVAILABLE); } } } } This is my CHILD prim/scriptI think my error is how i'm passing the info, but i can't seem to get it. All the help is greatly appreciated Link to comment Share on other sites More sharing options...
Kayaker Magic Posted November 8, 2011 Share Posted November 8, 2011 I don't like the syntax of your calls to llMessageLinked. I think you meant to say the following. The way you had it you were declaring LINK_SET to be an integer. (and 0 to be an integer). If this syntax works, it declares a new integer with the name of the LINK_SET defined constant, and new integers always start out with the value 0. (I don't have any idea what declaring 0 to be a new integer variable will do). llMessageLinked(LINK_SET,0, "", ""); 1 Link to comment Share on other sites More sharing options...
PeterCanessa Oh Posted November 8, 2011 Share Posted November 8, 2011 I'm very suprised this compiles but not that it fails to work as expected. http://wiki.secondlife.com/wiki/LlMessageLinked You need to include an INTEGER that is the link-number(s) addressed by the message and an INTEGER, STRING and KEY that are the parts of the message. llMessageLinked(integer LINK_SET, integer 1, "", ""); Is OK for the STRING and KEY (although technically keys and strings are different so it 'should' be NULL_KEY or similar) but for your two INTEGERS you are incorrectly and invalidly including the word 'integer'. You only need the 'LINK_SET' and '1'/'0' llMessageLinked(LINK_SET, 1, "", ""); Now you have several problems with how that message is received: Firstly 'if(sender_number == "1")' is comparing the INTEGER 'sender_number' with the STRING (because it's in quotes) "1" Don't worry too much about that because you're checking the wrong thing anyway ... sender_number is the link-number for the prim that sent the message, instead of what number was sent IN the message. You need to check if(number == 1) ... else if(number == 0) 1 Link to comment Share on other sites More sharing options...
nycbard Posted November 9, 2011 Author Share Posted November 9, 2011 Thank you, to the both of you, for helping me out. I understand now. Noob error =) Link to comment Share on other sites More sharing options...
Rolig Loon Posted November 9, 2011 Share Posted November 9, 2011 Now that you have the llMessageLinked syntax figured out, get rid of it. If all you are doing is changing a texture in the other prim, use llSetLinkTexture. That lets you change the texture in the other prim directly and it gets rid of an unnecessary script in that prim too. Link to comment Share on other sites More sharing options...
Helium Loon Posted November 10, 2011 Share Posted November 10, 2011 I'm actually surprised no-one else caught that your child script has the link_message() event handler INSIDE your state_entry(). That won't work. Your child script should be laid out like so: default{ state_entry() { } link_message(integer sender_number, integer number, string message, key id) { if ( number == 1 ){ fliptexture(AVAILABLE); } else if ( number == 0){ fliptexture(UNAVAILABLE); } }} Link to comment Share on other sites More sharing options...
Innula Zenovka Posted November 11, 2011 Share Posted November 11, 2011 Since you know that the query will return either 0 or 1 as a string, you can do it with llSetLinkTexture very easily: list textures=["uuid of offline texture","uuid of online texture"]; and then, dataserver(key requested, string data) { if (requested == query){ llSetLinkTexture(2,llList2Key(textures,((integer)data)),ALL_SIDES); } } Link to comment Share on other sites More sharing options...
Rolig Loon Posted November 11, 2011 Share Posted November 11, 2011 Exactly. And then you don't need the second script at all. :smileywink: 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