Jump to content

Show/hide objects by HUD :: wanted


MIVIMEX
 Share

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

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

Recommended Posts

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

You are about to reply to a thread that has been inactive for 2077 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...