Jump to content

Attachments prim always as HUD


Wurdy
 Share

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

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

Recommended Posts

Good evening, I became interested in the question: of how to make the HUD always dress correctly, from any point of attachment, I did it.
But now I have a question. Is it possible to write a script that will dress any prim as HUD?
For example, I will choose to attach to my left hand, but the prim will be dressed as a HUD anyway.

Link to comment
Share on other sites

If I understand you correctly, then yes: it is possible to write a script that governs where an object will attach to when worn. Take a look at llAttachToAvatar() and the variant llAttachToAvatarTemp(). They take an input parameter which identifies the target attachment point it will use. There are constants for each valid attachment point, including HUDs. See the wiki pages for the details.

Be aware there is a bit of a caveat with this... This will only work if you allow the script itself to do the attach. If you attempt to attach the object by using the viewer's menu and select an explicit point (like your left hand), then I believe that will override the script and forcibly attach the object to your left hand. In order to achieve your goal, you must let the script do the actual act of attaching.

Additionally, objects maintain data about where they were last attached to. So once the object has been successfully attached, it will "remember" that location. Form then on, that instance of the object will always attach to that same point if you use the generic "wear" action from the viewer (without specifying an attachment point).

Edited by Fenix Eldritch
  • Like 1
Link to comment
Share on other sites

On 26.02.2019 at 16:36, Fenix Eldritch said:

Если я вас правильно понимаю, то да: возможно написать сценарий, который будет определять, куда объект будет прикрепляться при ношении. Взгляните на llAttachToAvatar () и вариант llAttachToAvatarTemp () . Они принимают входной параметр, который определяет целевую точку подключения, которую он будет использовать. Существуют константы для каждой действительной точки подключения, включая HUD. Смотрите вики-страницы для деталей.

Имейте в виду, что с этим есть небольшая оговорка ... Это будет работать только в том случае, если вы позволите самому скрипту присоединиться. Если вы попытаетесь прикрепить объект с помощью меню средства просмотра и выберите явную точку (например, левой рукой), то я считаю, что это переопределит скрипт и принудительно прикрепит объект к левой руке. Чтобы достичь своей цели, вы должны позволить сценарию выполнить фактическое присоединение.

Кроме того, объекты хранят данные о том, где они были в последний раз прикреплены. Поэтому, как только объект был успешно прикреплен, он «запомнит» это местоположение. Затем создайте этот экземпляр объекта, который будет всегда присоединяться к той же точке, если вы используете общее действие «изнашивание» от зрителя (без указания точки присоединения).

Yes, you understood me correctly.
Apparently, if you use the inventory menu to dress things, then it ignores the script and there's nothing to be done about it, which is a pity.

Link to comment
Share on other sites

13 hours ago, Wurdy said:

if you use the inventory menu to dress things, then it ignores the script and there's nothing to be done about it

Yes and no... there is a way to attach using the inventory menu and not have it ignore previous settings. I mentioned it briefly in my previous response, but I'll go into deeper detail here. When you right click an object in your personal inventory, there will be several options on how to attach it:

Selecting the "Attach To..." menu item will present a list of attachment points and attach the object to whatever you select - thus overriding any script or previous attach point history the object had. Naturally, you don't want this option for your scenario.

Selecting "Wear" on the other hand, does not present you with a list to choose from. Instead, it attaches the the object to whatever point (and positional and rotational offset) that it previously had. The object remembers where it was last attached to and will continue to use that if you choose the "Wear" menu option.

I believe there are also "Add" and "Add To..."  options which work similarly to "Wear" and "Attach To..." except they don't detach stuff which already occupies the target attachment point.

If the object was never attached before, it will default to the right hand. So you can set up the object by manually attaching it to the desired point, and from then on, it will ways go to that same point when you select "Wear". Combined with the scripting option mentioned above, you can devise a way to reset the default worn position via script in the event the user accidentally overrides the attachment point. But again, that would only work if the object lets the script attach.

Additionally, you can also write a script to detect where the object is attached to and speak a warning message if it's not where you as the creator intended it to be. See the example code on the wiki page for llGetAttached(). That example goes so far as to detach the object if it detects its worn on the wrong spot.

Though I would wager most of the time, people will expect HUDs to be worn on the HUD points and won't try to explicitly attach them elsewhere. I think setting up the object beforehand (either by manually attaching the original copy to a HUD point or using the attach script) would be reasonable coverage.

 

Edited by Fenix Eldritch
Link to comment
Share on other sites

On 2/28/2019 at 1:36 AM, Wurdy said:

Apparently, if you use the inventory menu to dress things, then it ignores the script and there's nothing to be done about it, which is a pity.

No, that's a good thing. Nobody needs creators who can enforce of what they think (if any thinking is even involved) is good for me.

Link to comment
Share on other sites

8 hours ago, Nova Convair said:

No, that's a good thing. Nobody needs creators who can enforce of what they think (if any thinking is even involved) is good for me.

Well I could argue that there is a lot of stupid people both on the creator and user side of things.

A lot of really horrible scripting kludges are the result of creators simply not being given the means to do their work properly.

Link to comment
Share on other sites

1 minute ago, Kyrah Abattoir said:

Well I could argue that there is a lot of stupid people both on the creator and user side of things.

A lot of really horrible scripting kludges are the result of creators simply not being given the means to do their work properly.

What has that rant got to do with the subject?

Link to comment
Share on other sites

Just now, Love Zhaoying said:

I came to see the rant, and was slightly disappointed.

Was still a rant. Did not address Nova's comment. Sure there a bad scipter, there creators who use bad scripts. There are very few creators who do both. Reason is it takes ages and most creators are wanting a sales return. Still irrelievent to the OPs issue though.

Link to comment
Share on other sites

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