Yurtiel Posted March 12, 2014 Share Posted March 12, 2014 I have hit a brick wall and can't figure out what's going on (Again). integer sCh; integer gL; string nOwn; string gOwn; string dOwn; key uSr; default { state_entry() { sCh = -4000; dOwn = llDetectedKey(0); gOwn = llGetOwner(); nOwn = llKey2Name(gOwn); gL = llListen(sCh, "", gOwn, ""); llListenRemove(gL); } touch_end(integer ts) { vector vec = llDetectedTouchST(0); if(llDetectedTouchFace(0) == 4 && vec.x >= 0.6 && vec.x <= 1.0 && vec.y >= 0.64 && vec.y <= 0.8) llSay(0, "Stat Button Pressed"); llMessageLinked(2,0,"Touched",dOwn); } } Okay, on here I'm u sing a single prim main area for the main menu of the HUD.I get to the point where it detects if I'm touching on face 4, and if the vector is equal to or less than the X and Y of the "Stat Button" part of the prim.It successfully says "Stat Button Pressed."I assume it is then sending the llMessageLinked message of "Touched" to linked prim "2" which is the Stat Menu prim. Stat Menu Prim Code:integer sCh; integer gL; string nOwn; string gOwn; string dOwn; vector gPos; key uSr; default { state_entry() { sCh = -4000; dOwn = llDetectedKey(0); gOwn = llGetOwner(); nOwn = llKey2Name(gOwn); uSr = dOwn; gPos = llGetLocalPos(); gL = llListen(sCh, "", gOwn, ""); llListenRemove(gL); state st_menu; } } state st_menu { link_message(integer root, integer num, string msg, key dOwn) { if (msg == "Touched") llSay(0, "Moving"); } } This is the part that's infuriating me. The prim isn't doing the if command I tell it to from link_message, even when remove state st_menu and combine the link message if command block of code to the state entry it won't say anything. It's as if it's either NOT sending the llMessageLinked from the root prim to the linked prim, or the linked prim's link_message simply isn't recieving the message that is being sent and I can't seem to figure it out for the life of me because it works exactly as it should in a different script for something else I did perfectly fine.Oh great scripters of SL, show me what mine eyes apparently are fking blind too. Link to comment Share on other sites More sharing options...
Dora Gustafson Posted March 12, 2014 Share Posted March 12, 2014 A simple link message monitor like this: default{ link_message(integer sender_num, integer num, string msg, key id) { llOwnerSay( "num: "+(string)num+", msg: "+msg+", key: "+(string)id); }} Drop the script inside the prims in question and you can monitor each and every link message :smileysurprised::smileyvery-happy: Link to comment Share on other sites More sharing options...
Yurtiel Posted March 12, 2014 Author Share Posted March 12, 2014 Thanks, Now I know that the LLmessagelinked is happening and it is sending "Touched" to the prim it needs to send it too, but I still don't know why it isn't executing llsay(0,"Moving") when it recieves the linked message. Link to comment Share on other sites More sharing options...
Dora Gustafson Posted March 12, 2014 Share Posted March 12, 2014 llDetectedKey(0) in your state entry is doing no good It only gives valid results in certain events like touch, sensor and collision, so you have to redesign :smileysurprised::smileyvery-happy: Link to comment Share on other sites More sharing options...
Yurtiel Posted March 12, 2014 Author Share Posted March 12, 2014 nvm, for some reason it decided it was magically going to work now : / Thanks for the script though, that will help me a lot later on I believe. Link to comment Share on other sites More sharing options...
Dora Gustafson Posted March 12, 2014 Share Posted March 12, 2014 Yurtiel wrote: Thanks, Now I know that the LLmessagelinked is happening and it is sending "Touched" to the prim it needs to send it too, but I still don't know why it isn't executing llsay(0,"Moving") when it recieves the linked message. Are you sure the recieving child prim is number 2? Are you sure the scripts are in the same linkset? :smileysurprised::smileyvery-happy: Link to comment Share on other sites More sharing options...
revochen Mayne Posted March 12, 2014 Share Posted March 12, 2014 Dora Gustafson wrote: Are you sure the recieving child prim is number 2? Are you sure the scripts are in the same linkset? :smileysurprised::smileyvery-happy: And most important: Is the script set to running? :matte-motes-nerdy: Link to comment Share on other sites More sharing options...
revochen Mayne Posted March 12, 2014 Share Posted March 12, 2014 You also might want to know that the 'vec' touch position vector is normalized, means its scaled to a range between 0.0 to 1.0. This means vec.x will always be less or equal 1.0 but never any more. So you may remove the "vec.x <= 1.0" and a "&&" in the if condition statement. 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