Jump to content
MIVIMEX

Show/hide objects by HUD :: wanted

Recommended Posts

Hello! Need a script for three-button HUD to make one of the objects in the linkset visible. Reward 1000 Ls.

Share this post


Link to post
Share on other sites

here is an example, no need for payment.

1. rez a box and put this script in it.

 

integer numberOfColumns = 1;
integer numberOfRows = 3;
integer currentCellNumber;
default
{
    on_rez(integer rez)
    {  if (!llGetAttached() )    
       llResetScript();      
    }
    state_entry()
    {  llSetScale(<0.03, 0.15, 0.15>);       
       llSetObjectName("HUD test 4");  
       llSetLinkPrimitiveParamsFast(LINK_THIS,
         [  PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, 1.0,
            PRIM_TEXTURE, ALL_SIDES, "5748decc-f629-461c-9a36-a35a221fe21f", <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0,
            PRIM_TEXTURE, 4, "ac6b1c32-509c-eb96-107c-cc378669d8fd", <1.0, 3.0, 0.0>, ZERO_VECTOR, 0.0, 
            PRIM_LINK_TARGET, LINK_THIS,
            PRIM_COLOR, 4, <0.0, 1.0, 1.0>, 1.0]);
            
       llRequestPermissions( llGetOwner(), PERMISSION_ATTACH );  
    }    
    run_time_permissions( integer vBitPermissions )
    {  if ( vBitPermissions & PERMISSION_ATTACH )     
       {  llAttachToAvatar( ATTACH_HUD_TOP_CENTER );
          llSetPos(  <0,0,-0.1>); 
       } 
       else     
       llOwnerSay( "Permission to attach denied" );
    }
    attach(key id)
    {  if (id)
       { llOwnerSay( "The object is attached. ");
         llSetPos(  <0,0,-0.1>);   
         llReleaseCamera( llGetOwner() );
       }
       else 
       {  llOwnerSay( "The object has been detached");
       }
    }  
    touch_start(integer total_number)
    { 
       integer face =   llDetectedTouchFace(0); 
       vector touchST = llDetectedTouchST(0);        
        if (face == -1)
            llInstantMessage( llGetOwner(), "Sorry, your viewer doesn't support touched faces. Please update it!");
        else if (touchST == TOUCH_INVALID_TEXCOORD)
            llInstantMessage( llGetOwner(),"Sorry, a touch position could not be determined.");
        else if (face != 4)
            llInstantMessage( llGetOwner(),"Please touch the front!");   
             
        else  //we flip vertically and calculate a cell number
        {   currentCellNumber = llFloor(touchST.x*numberOfColumns) +
            (numberOfRows -llCeil(touchST.y*numberOfRows))*numberOfColumns + 1; 
        }
        if( currentCellNumber == 1)
        {   llRegionSay( -25,"invis" );
        }
        if( currentCellNumber == 2)
        {   llRegionSay( -25,"vis" );
        }
        if( currentCellNumber == 3)
        {
        }
    }
}

Then,  put this script in the linkset object you want to control...

 

default
{
    state_entry()
    { llListen(-25, "", "", "");
    }   
    listen(integer channel, string name, key id, string message)
    { if( message == "invis")
      {  llSetLinkAlpha(LINK_THIS, 0.0, ALL_SIDES);
      }
      if( message == "vis")
      {  llSetLinkAlpha(LINK_THIS, 1.0, ALL_SIDES);
      }
    }
}

you can take the HUD box and wear/add it, or just click OK to have it auto attach.

the first button is "invis" , the second one is "vis"

 

Edited by Xiija
  • Thanks 1

Share this post


Link to post
Share on other sites

@Xiija

Wow! Thank you so much! Almost what I need! But I apologize incorrectly expressed, it is necessary that only one of the three objects is visible. The other two became invisible. so that when the button is clicked, you can select which object is visible. Please, help!

And if it is possible for a mesh with three faces. Although the construction of the HUD is not so important, maybe simply take three - four prims. Thank you in advance. 

I am very sorry. I'm very, very sorry!

All the hope for you!

Edited by MIVIMEX

Share this post


Link to post
Share on other sites
On 8/7/2018 at 1:58 AM, Xiija said:

here is an example, no need for payment.

 

Thank you so much! The problem is solved thanks to you! tell me which account to send money to?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×