Jump to content

trying to make a HUD hide and unhide-Solved


carley Greymoon
 Share

You are about to reply to a thread that has been inactive for 1931 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

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

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 by carley Greymoon
  • Like 2
Link to comment
Share on other sites

  • carley Greymoon changed the title to trying to make a HUD hide and unhide-Solved
  • 7 months later...

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 by krash1256
Link to comment
Share on other sites

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

  • 8 months later...
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

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

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

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.

  • Like 1
Link to comment
Share on other sites

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

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

You are about to reply to a thread that has been inactive for 1931 days.

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
 Share

×
×
  • Create New...