Jump to content

HUD Question


MSTRPLN
 Share

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

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

Recommended Posts

Hello, i was wondering the following:

1. Can you attach/enable a HUD by clicking on an object? (im making a road system and i would like a HUD to pop-up when you click a road which will give you a texture changer HUD)
Why? Because, if possible i'd like to create a hud to style it how i like instead of using a dialog (also the person would see whichtexture is which) but only changing the texture of the object that's been clicked/selected

2. How would one select different elements in a HUD? for example those texture changer HUD's that let's you select which parts you want to change the texture of (for example a shirt you could enable/disable the front, back, sleeves, extras)

 

Thanks in advance :)

Ee8c9V2WSemf5kX7sMyZlg.png

Edited by MSTRPLN
Link to comment
Share on other sites

Second question first:  Use llDetectedTouchST, which you will find described in the LSL wiki.

The first question is harder, but only because I'm not sure that I understand your question.  I think you are asking about whether you can script some object that will enable a HUD when you click on it in world.  So, you wear the HUD and it is invisible or otherwise inactive until you click on a tree or something.  If that's what you mean, yes.  All you have to do is script the tree to send a message that can only be heard by something you are wearing, and tell your HUD to listen for it.  So the tree says:

llRegionSayTo(llDetectedKey(0),secret_HUD_channel,"I'm a tree!");

If your HUD is scripted to listen to secret_HUD_channel, it will be the only one to hear the message, even if there are 20 other people around with the same HUD. So..
 

listen (integer channel, string name, key id, string message)
{
    if (~llSubStringIndex(message,"tree"))
    {
        llSetAlpha(1.0,ALL_SIDES);
        llOwnerSay("You just touched a tree.");
    }
}

If I have completely missed your meaning, let's try again.

Edited by Rolig Loon
Link to comment
Share on other sites

1 hour ago, Rolig Loon said:

Second question first:  Use llDetectedTouchST, which you will find described in the LSL wiki.

The first question is harder, but only because I'm not sure that I understand your question.  I think you are asking about whether you can script some object that will enable a HUD when you click on it in world.  So, you wear the HUD and it is invisible or otherwise inactive until you click on a tree or something.  If that's what you mean, yes.  All you have to do is script the tree to send a message that can only be heard by something you are wearing, and tell your HUD to listen for it.  So the tree says:

llRegionSayTo(llDetectedKey(0),secret_HUD_channel,"I'm a tree!");

If your HUD is scripted to listen to secret_HUD_channel, it will be the only one to hear the message, even if there are 20 other people around with the same HUD. So..
 


listen (integer channel, string name, key id, string message)
{
    if (~llSubStringIndex(message,"tree"))
    {
        llSetAlpha(1.0,ALL_SIDES);
        llOwnerSay("You just touched a tree.");
    }
}

If I have completely missed your meaning, let's try again.

Hmm not really. More like (keeping it simple for now):

Item A has 2 items in it's contents: 1. Script - 2. Item B ( called HUD)

when clicking on item A it will attach item B as a HUD. I managed to do something like this with llAttachToAvatarTemp but it attaches "Item A" rather than "Item B"

default
{
    state_entry()
    {
        llRequestPermissions( llGetOwner(), PERMISSION_ATTACH );
        llSay(0, "Hello, Avatar!");
    }

    touch_start(integer total_number)
    {
        integer totalItems = llGetInventoryNumber(INVENTORY_ALL);
        integer index;
        while (index < totalItems)
        {
            if(PERMISSION_ATTACH)
            {
                    string itemName = llGetInventoryName(INVENTORY_OBJECT, 0);
                    integer type = llGetInventoryType(itemName);
                    if (itemName == "HUD")
                    {
                        llAttachToAvatarTemp((integer)ATTACH_HUD_CENTER_1);
                        llSay(0,"Attached!");
                    } else {
                        llSay(0,"Not attached :(");
                    }
            }
        }
    }
}

Not really going deep into permissions etc, just trying to get the attaching to work. i tried adding the item name, type etc in the "" llAttachToAvatarTemp" but that gave me the following error "Function call mismatches type or number of arguments" and the wiki only says it needs a integer & attach point, not an example of attaching a different object.

Link to comment
Share on other sites

We are all waiting for such functionality to attach an object from another objects inventory directly.:)
Until then we have to rez the object first. Once rezzed, the HUD itself will have to ask for permissions to attach. If it's supposed to work for the owner only, it's easy. If it's supposed to attach to non owners as well, you need some communication between the rezzer and the HUD, to pass along the key of the touching agent, so that the HUD knows to which agent it has to send the perm request.

Link to comment
Share on other sites

3 minutes ago, arton Rotaru said:

We are all waiting for such functionality to attach an object from another objects inventory directly.:)
Until then we have to rez the object first. Once rezzed, the HUD itself will have to ask for permissions to attach. If it's supposed to work for the owner only, it's easy. If it's supposed to attach to non owners as well, you need some communication between the rezzer and the HUD, to pass along the key of the touching agent, so that the HUD knows to which agent it has to send the perm request.

Hmm, any pointers how i would do that? (yes owner only, because i want to use this to change between different decals on the roads. I'd rather have a hud with thumbnails than a dialog)

Link to comment
Share on other sites

5 hours ago, arton Rotaru said:

We are all waiting for such functionality to attach an object from another objects inventory directly.:)
Until then we have to rez the object first. Once rezzed, the HUD itself will have to ask for permissions to attach. If it's supposed to work for the owner only, it's easy. If it's supposed to attach to non owners as well, you need some communication between the rezzer and the HUD, to pass along the key of the touching agent, so that the HUD knows to which agent it has to send the perm request.

It's a shame LL decided to shelve temp attaching from object inventory. "What might have been..."

  • Like 1
Link to comment
Share on other sites

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