carley Greymoon Posted September 27, 2017 Share Posted September 27, 2017 i'm trying to find a simple solution to hiding a hud i built. i thought i found the answer using a simple door script that flips(rotates) the HUD off screen. that works perfect, i put the script in the root prim and when clicked it hides the HUD. the problem is when i click a child prim in the linkset it also hides the HUD. i've tried to solve this but i don't understand what i am reading well enough. from what i understand by default when the root prim has a touch handler and the child prims don't, when a child prim is clicked it passes that touch onto the root prim and it's script is executed. there is a Pass_Never flag that when used within a script that is placed in each child prim, the child will not pass the touch onto the root prim. that is what i need to happen but that would mean every prim in the linkset needs it's own script. that's not feasible for my project. is there a simple way to do this without putting a script in each prim? i know very little scripting and at this point my head kind of hurts, if someone can just help me get past this sticking point it'd be very appreciated. Thank you. Link to comment Share on other sites More sharing options...
Ruthven Ravenhurst Posted September 27, 2017 Share Posted September 27, 2017 in the script that handles hiding the hud, you'll want to add the logic: if(llDetectedLinkNumber(0) == llGetLinkNumber())//checks to see if the prim you touched is the one containing this script { //code to hide/show the hud } This is assuming that all the root prim does is show/hide the hud Link to comment Share on other sites More sharing options...
carley Greymoon Posted September 27, 2017 Author Share Posted September 27, 2017 (edited) Thank you so much Ruthven it worked! It took a little bit to find the right place to insert the code but i got:) again a very big thanks to you Ruthven here is the script in case anyone else can use it. integer gIntSwing = 90; rotation gRotSwing; default{ state_entry(){ gRotSwing = llEuler2Rot( <3.0, 0.0, (float)gIntSwing * DEG_TO_RAD> ); } touch_start(integer total_number){ if(llDetectedLinkNumber(0) == llGetLinkNumber()) { } } touch_end( integer vIntNul ){ if(llDetectedLinkNumber(0) == llGetLinkNumber()) llSetLocalRot( (gRotSwing = (ZERO_ROTATION / gRotSwing)) * llGetLocalRot() ); } } Edited September 27, 2017 by carley Greymoon 2 Link to comment Share on other sites More sharing options...
krash1256 Posted April 29, 2018 Share Posted April 29, 2018 I've been trying to find a script exactly like this but I want the Hud flip down and back up, not sideways. I don't script and I don't know how to change it so it will swing down and back up. Link to comment Share on other sites More sharing options...
Ruthven Ravenhurst Posted April 29, 2018 Share Posted April 29, 2018 That's easy enough, I believe in the script that carley posted, you would just change the rotation vector so the rotated axis is Y instead of Z gRotSwing = llEuler2Rot( <0.0, (float)gIntSwing * DEG_TO_RAD,0.0> ); Link to comment Share on other sites More sharing options...
krash1256 Posted April 29, 2018 Share Posted April 29, 2018 (edited) Well, that didn't work. What I'm trying to do is. I have a hud at the bottom of my screen with four buttons for different things. Then at the very bottom I have a button that hides unhides the hud. I found a script that hides unhides it but the buttons can still be touched. So I found this script and it flips it sideways. What I want is the hud to turn upside down when I click on the button, have it rotate down without hiding the bottom button and then click on the button again to bring it upright again. Do you understand what I mean. I want to turn the whole thing upside down but still facing in the same direction. It will just be down and out of sight. Edited April 29, 2018 by krash1256 Link to comment Share on other sites More sharing options...
Ruthven Ravenhurst Posted April 29, 2018 Share Posted April 29, 2018 ok, for it to be facing the same direction, then probably the X axis would do what you want, but you need to change the angle to 180 degrees instead of 90 try this... integer gIntSwing = 180; rotation gRotSwing; default{ state_entry(){ gRotSwing = llEuler2Rot( <(float)gIntSwing * DEG_TO_RAD,0.0,0.0> ); } touch_start(integer total_number){ if(llDetectedLinkNumber(0) == llGetLinkNumber()) { } } touch_end( integer vIntNul ){ if(llDetectedLinkNumber(0) == llGetLinkNumber()) llSetLocalRot( (gRotSwing = (ZERO_ROTATION / gRotSwing)) * llGetLocalRot() ); } } Link to comment Share on other sites More sharing options...
krash1256 Posted April 29, 2018 Share Posted April 29, 2018 OMG, that did it. Thank you so much. 1 Link to comment Share on other sites More sharing options...
eclipz13 Waco Posted January 5, 2019 Share Posted January 5, 2019 On 4/28/2018 at 9:43 PM, Ruthven Willenov said: ok, for it to be facing the same direction, then probably the X axis would do what you want, but you need to change the angle to 180 degrees instead of 90 try this... integer gIntSwing = 180; rotation gRotSwing; default{ state_entry(){ gRotSwing = llEuler2Rot( <(float)gIntSwing * DEG_TO_RAD,0.0,0.0> ); } touch_start(integer total_number){ if(llDetectedLinkNumber(0) == llGetLinkNumber()) { } } touch_end( integer vIntNul ){ if(llDetectedLinkNumber(0) == llGetLinkNumber()) llSetLocalRot( (gRotSwing = (ZERO_ROTATION / gRotSwing)) * llGetLocalRot() ); } } Perhaps this is a noobish question, But i would like to change what link i click, but simply changing the "llDetectedLinkNumber(0)" to "llDetectedLinkNumber(3)" doesn't work as i thought.. any advice is greatly appreciated ❤️ Link to comment Share on other sites More sharing options...
Rolig Loon Posted January 5, 2019 Share Posted January 5, 2019 You are misunderstanding the way that function (and all other functions like it) works. llDetectedLinkNumber(0) is literally "the first link that was detected by this click." llDetectedLinkNumber(3) would mean "the fourth link detected by this click." Since you can only click on one specific link, therefore, llDetectedLinkNumber(3) doesn't make any sense. It will always fail. What you'll want to do is detect the click and then ask "which link was just touched?" if ( llDetectedLinkNumber(0) == 3 ) { // Do something } Link to comment Share on other sites More sharing options...
eclipz13 Waco Posted January 5, 2019 Share Posted January 5, 2019 15 minutes ago, Rolig Loon said: You are misunderstanding the way that function (and all other functions like it) works. llDetectedLinkNumber(0) is literally "the first link that was detected by this click." llDetectedLinkNumber(3) would mean "the fourth link detected by this click." Since you can only click on one specific link, therefore, llDetectedLinkNumber(3) doesn't make any sense. It will always fail. What you'll want to do is detect the click and then ask "which link was just touched?" if ( llDetectedLinkNumber(0) == 3 ) { // Do something } Thank you for your response, i am still somewhat new when it comes to scripting, i'm constantly learning as i go.. So I don't quite understand why, but when i tried to edit the script to this, i get the syntax error.. The goal is to simply change what linked piece i click for the show/hide other than the "root" prim. integer gIntSwing = 90; rotation gRotSwing; default{ state_entry(){ gRotSwing = llEuler2Rot( <3.0, 0.0, (float)gIntSwing * DEG_TO_RAD> ); } touch_start(integer total_number){ if(llDetectedLinkNumber(0) == 3 ) llGetLinkNumber() { } } touch_end( integer vIntNul ){ if(llDetectedLinkNumber(0) == 3 ) llGetLinkNumber()) llSetLocalRot( (gRotSwing = (ZERO_ROTATION / gRotSwing)) * llGetLocalRot() ); } } Link to comment Share on other sites More sharing options...
Rolig Loon Posted January 5, 2019 Share Posted January 5, 2019 OK, back up and look at what Ruthven was trying to make the script do. He wrote touch_start(integer total_number) { if(llDetectedLinkNumber(0) == llGetLinkNumber()) { } } That is, "Get the number of the link that was just clicked and compare it to the number of the link that contains this script. If they are the same, do something." That's not what you want to do. You are asking a different question: "Get the number of the link that was just clicked and compare it to the link numbered 3. If they are the same, do something." touch_start(integer num) { if (llDetectedLinkNumber(0) == 3) { // Do something } } which is what I told you before. 1 Link to comment Share on other sites More sharing options...
steph Arnott Posted January 5, 2019 Share Posted January 5, 2019 33 minutes ago, eclipz13 Waco said: Thank you for your response, i am still somewhat new when it comes to scripting, i'm constantly learning as i go.. So I don't quite understand why, but when i tried to edit the script to this, i get the syntax error.. The goal is to simply change what linked piece i click for the show/hide other than the "root" prim. integer gIntSwing = 90; rotation gRotSwing; default{ state_entry(){ gRotSwing = llEuler2Rot( <3.0, 0.0, (float)gIntSwing * DEG_TO_RAD> ); } touch_start(integer total_number){ if(llDetectedLinkNumber(0) == 3 ) llGetLinkNumber() { } } touch_end( integer vIntNul ){ if(llDetectedLinkNumber(0) == 3 ) llGetLinkNumber()) llSetLocalRot( (gRotSwing = (ZERO_ROTATION / gRotSwing)) * llGetLocalRot() ); } } The second line at touch start has a function slapped onto the end which is a syntax error. The second line at touch end makes no sense with the same added function. The ==3) is already doing a link number comparison. If the touch link is number 3 then exicute the following code block else ignore it. Link to comment Share on other sites More sharing options...
eclipz13 Waco Posted January 5, 2019 Share Posted January 5, 2019 43 minutes ago, Rolig Loon said: OK, back up and look at what Ruthven was trying to make the script do. He wrote touch_start(integer total_number) { if(llDetectedLinkNumber(0) == llGetLinkNumber()) { } } That is, "Get the number of the link that was just clicked and compare it to the number of the link that contains this script. If they are the same, do something." That's not what you want to do. You are asking a different question: "Get the number of the link that was just clicked and compare it to the link numbered 3. If they are the same, do something." touch_start(integer num) { if (llDetectedLinkNumber(0) == 3) { // Do something } } which is what I told you before. Perfect! thank you so much ❤️ Link to comment Share on other sites More sharing options...
steph Arnott Posted January 5, 2019 Share Posted January 5, 2019 14 minutes ago, eclipz13 Waco said: Perfect! thank you so much ❤️ BTW you do not take the link number shown in edit as fact because it is usually incorrect. I used to get caught out with that one. 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