Jump to content

Attach HUD fail


EnCore Mayne
 Share

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

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

Recommended Posts

i have an idea i'm trying to script that has an avatar sit on a chair and a HUD attaches. so far, i've got a version that works for me (or any owner) but i'd like to get it so that when any avatar sits the HUD attaches and will work for them.

i've managed to get the accept attach AND trigger animation to show up on the sitter's screen but on accepting the HUD (rezzed by sitting) it doesn't attach.

i'm thinking it's either 1.) impossible or,  2.) i have no idea how to script this. #2 may be obvious at this point but ... can this be done at all by people better than me? i'm not inworld now but if you need code/pseudo code i'll show what i've got so far.

Edited by EnCore Mayne
Link to comment
Share on other sites

There is only one exception to the general rule that objects may be attached only to their owners.   

The exception -- whereby a dining table, for example, can attach knives and forks to all the diners, even though they don't own the dining table -- is when you use llAttachToAvatarTemp, which enables the object to attach to the avatar without creating an inventory entry.

Normally, I use llAttachToAvatarTemp with experience permissions, which means that avatars who have already accepted the experience don't get bothered with subsequent attachment requests and the items just rez and attach silently,   

If you use it with regular llRequestParmissions(id, PERMISSION_ATTACH) then it still works, as far as I know, but the sitter has to agree to the object attaching each time.   

So yes, it certainly can be done, but I'd need to see the code before I can usefully say much more.

  • Like 1
Link to comment
Share on other sites

Innula's right. Unless you are scripting in an experience, the user will need to give permissions twice -- once for PERMISSION_TRIGGER_ANIMATION when she sits down (assuming that you plan on animating  her) , and the second for PERMISSION_ATTACH after the seat rezzes your HUD.  The seat requests the first permission and the HUD requests the second one.   The seat's request is granted automatically and silently, so the user is never aware of it, but you cannot attach the HUD without asking the user explicitly, unless you are in an experience.  Over the years, I have scripted quite a few items to work this way for clients.  It's a bit annoying and it interferes with the user's sense of immersion, but the alternative could invite abuse. 

Edited by Rolig Loon
Link to comment
Share on other sites

looks like i'm doing everything right BUT the HUD doesn't seem to know who's asking for permissions(???)

the script in the seat sits the avi and rezzes the HUD fine

llRezObject (the HUD) and PERMISSION_TRIGGER_ANIMATION perm request is in the changed event of seat.

the script in the HUD has the llRequestPermissions to attach in the on_rez event and it results in: >>>Unable to find specified agent to request permissions.<<<

how does the HUD script know who to attach it to?

Link to comment
Share on other sites

You have to pass it that information on rez.  You can't do that directly, but rezzing an object automatically triggers an object_rez event, if there's one in your script.  So ypu write
 

object_rez (key id)
{
    llSleep(0.3);  // To give the new object time to rez and open a channel
    llRegionSayTo(id,iChan, (string)kAv);    // Where kAv is the UUID of your target person
}

The only real trick is telling the new object what iChan is.  It's just an integer, though, so pick one and pass it as the final variable in your llRezAtRoot statement.  Tell the new object to open a channel and listen for the rezzer. 

Edited by Rolig Loon
Link to comment
Share on other sites

  • 2 weeks later...
On 9/18/2018 at 9:40 PM, Rolig Loon said:

You have to pass it that information on rez.  You can't do that directly, but rezzing an object automatically triggers an object_rez event, if there's one in your script.  So ypu write
 


object_rez (key id)
{
    llSleep(0.3);  // To give the new object time to rez and open a channel
    llRegionSayTo(id,iChan, (string)kAv);    // Where kAv is the UUID of your target person
}

The only real trick is telling the new object what iChan is.  It's just an integer, though, so pick one and pass it as the final variable in your llRezAtRoot statement.  Tell the new object to open a channel and listen for the rezzer. 

i have failed "attempting" to apply your advise. from what i can recall from the numerous (far too many to count) recoding disasters befalling my once sensitive mind it seems from my stultified understanding the HUD sends the avatar's UUID as a string. getting the string reading as the avatar's key seems beyond me. that's aside whether i've got the listen set up correctly. 

i'm sure it's a simple matter (for those in the know) but how do i convert the string UUID into a key?

Link to comment
Share on other sites

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