Jump to content
sgtmarkoes

Creating hud, have a small question...

Recommended Posts

Hello everyone, I'm currently working on a hud, and it goes well,  but ran into a problem, I created a button and have the script to show?hide the hud, only problem is that when the hud is hided, the other buttons are still clickable,, SO I tried to change the script so when I hide it the it will also move the rest of the hud (that will be hiding)  off screen, so it's not in the way anymore, and when you click the button agian to show it up again, it will go to the right position again. but it's not working for me, any idea's? would be great if you guys/gals can help me out. Thank you

Share this post


Link to post
Share on other sites

It sounds as if you are "hiding" the HUD by making it transparent.  That's not a good idea, as you have discovered.  You can still click a transparent object.

Take a look at this thread for better ideas >>>

 

Share this post


Link to post
Share on other sites
30 minutes ago, Rolig Loon said:

It sounds as if you are "hiding" the HUD by making it transparent.  That's not a good idea, as you have discovered.  You can still click a transparent object.

Take a look at this thread for better ideas >>>


 

HI there I've take a look at the topic, Make sense to rotate them, But I'm not so good with LSL scripting tho,  This thing is the only way that's stand in my way haha, I'm not sure where I need to put the line for it to get it to work, let me show you the script I use:


there are 2 scripts, One is the "Receiver script" and the other one is the"HIde&show " script:

 

Receiver script: 

// Hide Me Show Me - Transmitter Script
// A full-permission Script by Der45Grayson

// Please change the following two variables in this script
//  and in the "Hide Me Show Me Receiver" script

integer myswitch;
string  action; 
integer MY_CHANNEL    = 27;            // Change this to a unique number
string  MY_Button_ID  = "hideMe";      // The Button's unique ID name
string  MY_Object_ID  = "hshud";       // The object's unique ID name
// Then copy this script from your inventory (drag + drop). into your object that will act as the switch fore the object you want Hide/Show.
default
{ 
    state_entry()
    {        
      myswitch=FALSE;
      action = "show";
      llWhisper(MY_CHANNEL,MY_Object_ID+" "+MY_Button_ID+" "+(string)action);
    }
    touch_start(integer total_number)
    {      
       if(myswitch==FALSE)
       {           
       //Hide Tte Object  
       myswitch=TRUE;
       action = "hide";
       llWhisper(MY_CHANNEL,MY_Object_ID+" "+MY_Button_ID+" "+(string)action);
       }
       else
       {  
      //Show Tte Object 
      myswitch=FALSE;
      action = "show";
      llWhisper(MY_CHANNEL,MY_Object_ID+" "+MY_Button_ID+" "+(string)action);
      }
    }
}

Show&hide script:
 



integer MY_CHANNEL    = 27;         // This number must match the transmitter script
string  MY_Button_ID  = "hideMe";   // This Button ID must also match
string  MY_Object_ID  = "hshud";    // This Object ID must also match
// Then copy this script from your inventory (drag + drop). into your object you want to Hide/Show.

default
{
    state_entry()
    {
        llListen(MY_CHANNEL,"",NULL_KEY,"");
    }
    
    listen(integer channel, string name, key id, string message)
    {
        if (llGetOwnerKey(id) != llGetOwner())
        {
        // Only a Script owned by the same owner of this script will be acted upon 
            return;
        }    
        if (llSubStringIndex(message,MY_Object_ID+" "+MY_Button_ID) > -1)
        {
            string newsaction = (string)llGetSubString(message,(llSubStringIndex(message,MY_Button_ID+" ")+(llStringLength(MY_Button_ID)+1)),-1);    
            // We have a new String commend named "newsaction".  You can use this in several ways:
            // Change this prims alpha to 0.0:
            if(llToLower(llStringTrim(newsaction, STRING_TRIM))=="hide"){
            llSetAlpha(0.0,ALL_SIDES);
            } 
            // Change this prims alpha to 1.0:
            if(llToLower(llStringTrim(newsaction, STRING_TRIM))=="show"){
            llSetAlpha(1.0,ALL_SIDES);
            } 
        } 
    }
}

 

so yeah these are the script(s) I use to hide & and show the rest of the hud, but not sure where to you need to add the rotation line? I also Know you got multiple ways to use the rotation function, I have no idea which one I need to use , I feel such a noob. I should learn LSL scripting to haha. 

Share this post


Link to post
Share on other sites
3 minutes ago, arton Rotaru said:

So, who is going to tell sgtmarkoes that these scripts are hardly suitable for a HUD. :SwingingFriends:

 

Is the script that bad? haha, I mean for me now it's working fine, just need to rotate it xD   I don't need much,  it only needs to show what it need to show,, and that works fine. :) 

Btw Is there a way with scripting, if you click a "button" it will open the IM box of that person you want to contact? 

Share this post


Link to post
Share on other sites
10 minutes ago, arton Rotaru said:

So, who is going to tell sgtmarkoes that these scripts are hardly suitable for a HUD.

I was searching for the right words, but I think you just nailed it, arton.

@sgtmarkoes, those scripts are hardly suitable for a HUD.  To rotate the HUD, you don't need to add a line to those scripts.  You need to write a totally different script.  If you're not up to it, the best solution is to post in the InWorld Employment forum to attract a scripter who will write a custom script to fit your situation.

  • Like 1

Share this post


Link to post
Share on other sites
48 minutes ago, sgtmarkoes said:

Btw Is there a way with scripting, if you click a "button" it will open the IM box of that person you want to contact? 

Nope.

52 minutes ago, sgtmarkoes said:

Is the script that bad? haha, I mean for me now it's working fine, just need to rotate it xD   I don't need much,  it only needs to show what it need to show,, and that works fine. :) 

There are way to many unkowns to just add a simple mod to the scripts. The rotation method shown in the linked thread is best suited for 100 % mesh huds, which are build with the rotating stuff in mind already. If your HUD is build of prims, it's a different story anyway.

 

Share this post


Link to post
Share on other sites

   A hud can be created using mesh so that it only has faces in one direction, for instance, the -X side, which is the default ZERO_ROTATION for a newly attached hud. This side can have all the buttons you need for the function of your hud, including a minimize button. The minimize button can be made to rotate the hud, using llSetLocalRot(), 180°. To serve as your maximize button, occupying the same screen space position as your minimize button, place one small face on the +X side.

   The advantages of this method are that when the hud is minimized, only one small button is showing. Everything else, having no faces presented to the user, is completely click-through, and will register no touches. There is no need to move any hud elements off-screen.  It will also not interfere with your use of the camera. 

Edited by Ivanova Shostakovich
To correct the default hud rotation information.

Share this post


Link to post
Share on other sites

alright, so if I want to start creating a HUD in mesh, should I use a program like blender for it? or do you guys have other software recommendations ? :) 

Share this post


Link to post
Share on other sites
18 minutes ago, sgtmarkoes said:

alright, so if I want to start creating a HUD in mesh, should I use a program like blender for it? or do you guys have other software recommendations ? :) 

i have mesh studio, which allows you to build a prim set and convert it to mesh. I can build the hud, attach it, change things around to perfect it. then mesh it

Share this post


Link to post
Share on other sites
33 minutes ago, sgtmarkoes said:

...recommendations?

   You will need a modeling program that allows you to delete unwanted faces from primitives. Blender and Wings are the two that I am familiar with. They can both do the job.

   If mesh studio has a setting that allows the creation of a mesh object with custom placement and orientation of faces, then this may work for you. Unlike the two other solutions mentioned above, it is not free.

Share this post


Link to post
Share on other sites
8 hours ago, Ivanova Shostakovich said:

 You will need a modeling program that allows you to delete unwanted faces from primitives. Blender and Wings are the two that I am familiar with. They can both do the job.

And you will still need to learn how to write LSL scripts.  A static HUD without a script is worthless.  B|

Share this post


Link to post
Share on other sites

to rotate the root, ( and the whole linkset..) 90 degrees...

 llSetLinkPrimitiveParamsFast(1,[PRIM_ROTATION,llGetLocalRot() * llEuler2Rot(<0,0,90>*DEG_TO_RAD)]);
 llSetLinkPrimitiveParamsFast(1,[PRIM_POSITION,llGetLocalPos() + <0.0 ,0.2, 0.0> ]);  // if you need to move, do it here

to IM someone from a link in a script... put this in a string and "say" it on your button click?

 ( using my UUID, replace with yer own :P )

 secondlife:///app/agent/06451596-818c-4975-8bc0-058ab2fe8274/im

Edited by Xiija

Share this post


Link to post
Share on other sites

Here is a very simple approach to show/hide a prim HUD. And a very basic script that handles all the action from the root prim with just a single script. Maybe you can adapt your HUD to something similar, I don't know. Anyway, here we go.

SimpleHUD01.jpg.d1735ed37b6be53c94f3396d23501458.jpg

 

integer giIndex;

list glButtons = [
"Button 1", "shooting stars", 
"Button 2", "never stop",
"Button 3", "even", 
"Button 4", "when",
"Button 5", "they",
"Button 6", "reach",
"Button 7", "the top",
"Button 8", "there goes",
"Button 9", "a supernova",
"Button 10", "what a",
"Button 11", "pushover",
"Button 12", "yeah"]; 



default
{
    touch_start(integer total_number)
    {
        integer iLinkNum = llDetectedLinkNumber(0);
        string sName = llGetLinkName(iLinkNum);
        if (sName == "Off") 
        {
            llSetLinkPrimitiveParamsFast(LINK_ROOT, [PRIM_ROTATION, llEuler2Rot(<0.0,0.0, PI>)]);
        }
        else if (sName == "On")
        {
            llSetLinkPrimitiveParamsFast(LINK_ROOT, [PRIM_ROTATION,ZERO_ROTATION]);
        }
        else 
        {
            if (~(giIndex = llListFindList(glButtons, (list)sName)))
            {
                llOwnerSay(llList2String(glButtons, giIndex+1));
            }
        }           
    }
}

 

  • Like 1

Share this post


Link to post
Share on other sites
4 hours ago, Xiija said:

to rotate the root, ( and the whole linkset..) 90 degrees...

 llSetLinkPrimitiveParamsFast(1,[PRIM_ROTATION,llGetLocalRot() * llEuler2Rot(<0,0,90>*DEG_TO_RAD)]);
 llSetLinkPrimitiveParamsFast(1,[PRIM_POSITION,llGetLocalPos() + <0.0 ,0.2, 0.0> ]);  // if you need to move, do it here

to IM someone from a link in a script... put this in a string and "say" it on your button click?

 ( using my UUID, replace with yer own :P )

 secondlife:///app/agent/06451596-818c-4975-8bc0-058ab2fe8274/im

HI mate, thanks for helping out, and that goes for everyone :D    but have a small question, about the IM one, What is the best way to  write the code? sure with a string and trigger on touch as far as I know, but not sure how, If they link a button and that button if you clicked on it, it will open or you can send a message to the person's IM (box) ? 

Share this post


Link to post
Share on other sites

the only way i know to do it is in chat?

 touch_start(integer total_number)
    {  llSay(0, "secondlife:///app/agent/85987995-ab09-42db-9bd0-e0c558aa8c14/im " );
    }

that puts a clickable link in chat, which opens an IM when clicked :)

Share this post


Link to post
Share on other sites
4 hours ago, sgtmarkoes said:

HI mate, thanks for helping out, and that goes for everyone :D    but have a small question, about the IM one, What is the best way to  write the code? sure with a string and trigger on touch as far as I know, but not sure how, If they link a button and that button if you clicked on it, it will open or you can send a message to the person's IM (box) ? 

Why do you want to open the person's IM box?    What message do you want to send them and why do you want to use a HUD to do it rather than simply find them on your friends list or in search?     Xiija's suggestion is the only way I can think of actually opening a box at your end so you can enter a message.  

You could also, if you really wanted to, touch a button to open up a form with llTextBox(), use that to enter the name of whoever you want to contact, and then use that to look up that their uuid on an external website and then, assuming you've retrieved the UUID, have llTextBox open up again in the http_response event and then you enter your message in this new box.

Then click send, and it should send your message to your friend, though it would appear in local chat (though only on your friend's viewer) rather than in an IM box.

But I really don't see why you'd want to go to all that trouble rather than use the built-in tools in the viewer to send an IM in the normal way.

Share this post


Link to post
Share on other sites
4 minutes ago, Innula Zenovka said:

Why do you want to open the person's IM box?    What message do you want to send them and why do you want to use a HUD to do it rather than simply find them on your friends list or in search?     Xiija's suggestion is the only way I can think of actually opening a box at your end so you can enter a message.  

You could also, if you really wanted to, touch a button to open up a form with llTextBox(), use that to enter the name of whoever you want to contact, and then use that to look up that their uuid on an external website and then, assuming you've retrieved the UUID, have llTextBox open up again in the http_response event and then you enter your message in this new box.

Then click send, and it should send your message to your friend, though it would appear in local chat (though only on your friend's viewer) rather than in an IM box.

But I really don't see why you'd want to go to all that trouble rather than use the built-in tools in the viewer to send an IM in the normal way.

I see, well the reason I want that, is because I'm making a staff hud for a Adult club, and when the staff open the hud there will be a tab Called "Contact managers"  so when the staff  click on that tab they can contact any manager as soon as possible.  well that's what I'm aiming for.  that's why I wanted to know if there was a way to do that. ;)  :) 

Share this post


Link to post
Share on other sites

In that case, I think you will have to go with Xiija's method, and have the HUD chat the link to the wearer in local text that only the wearer can see (llOwnerSay_.   Or, since you have only a limited number of people to contact, you press a button for the manager of your choice and have llTextBox open for the message you want to send.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...