Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Sit on an Object to Show a HUD?

Rygel Ryba
Registered User
Join date: 12 Feb 2008
Posts: 254
02-23-2008 10:59
I've been looking for an example script of this for hours now and have given up. It seems like it should be really simple, but I can't find an example to get me started.

I made a HUD that is basically a black box that blocks out the screen (as if you were wearing a blindfold). It then has cylinders on it with a swirly texture to give the person something to look at while they have it on.

When it's in my inventory, I wear it, it works fine and it looks great. But I don't want to hand this out as something that someone puts on from their inventory. I want to put it on a chair and then (with permission - which I think is required) have the HUD that I have put into my chair's inventory block their view. (Think of it as a sort of - "okay, sit here and cover your eyes while I set up this surprise... Okay. Now stand up and look! Surprise!";)

Seems like this should be simple and something that I could find rather easily in the example code scattered around here and on the rest of the web, but I'm at a loss.

Any help?

Thanks!
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
02-23-2008 11:25
I don't know of any specific examples but I suspect llAttachToAvatar is your only option. However, it looks like llAttachToAvatar only works for an object's owner:

From: llAttachToAvatar
Even though users other than the owner can grant this permission, attaching to them will fail with the message "Script trying to attach to someone other than owner!".
Which could be a deal breaker if the chair is to be public access.
Anthony Hocken
Registered User
Join date: 16 Apr 2006
Posts: 121
Try camera controls instead
02-23-2008 11:27
Think I can see what you're trying to do but doubt it's possible to automate this without asking the user manually wear the HUD.

Another way worth considering though is just to control the camera position. So when they sit on the object it changes their camera position to look at a blank prim somewhere nearby. The user probably doesnt even have to agree to a permissions dialog to do this because they're sitting, so camera control is granted automatically, so this is all nicely automated from the moment they sit on your object.

A nice touch to do with the textures on the surprise object you want to show would be to show the same textures on the "blindfold" prim. Even if it's a fragment of the textures shown it'll mean the textures get preloaded while the user is blindfolded. So when the blindfold is removed they instantly see the surprise without having to wait for the textures to load. If there are black areas on the textures for example (and you have a black blindfold) then just show the black parts on the blindfold and the user will be none the wiser.
_____________________
Rygel Ryba
Registered User
Join date: 12 Feb 2008
Posts: 254
02-23-2008 11:34
Thanks for the replies. I suppose moving the camera somewhere would work, but I was hoping for not having to have extra prims lying around.

Seems strange to me that the term HUD originated in military vehicles and I can't make a tank where a control hud appears when I sit in it. lol

Oh well. Thanks again.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
02-23-2008 13:39
Well, you can make a pre-made and already attached HUD go from not displayed (offscreen, shrunken and transparent, whatever) to displayed. Or if the resident already owns it, (like if the avatar owned the vehicle/furniture and the HUD was rezzed in-world), you could use llAttachToAvatar() after obtaining the appropriate permission. By communicating with the object you could make it happen when the avatar sits. But for a HUD that the person doesn't already own (attached or in-world)? Nope.
Rygel Ryba
Registered User
Join date: 12 Feb 2008
Posts: 254
02-23-2008 13:47
Can that hud be in the object the sit on? Basically, I don't want the person who sits and gets blindfoled to end up with the blindfold HUD in their inventory.
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
02-23-2008 14:23
No, you can't sit on an attachment, or attach something that's being sat on. (Just try to imagine how that would work!)

Camera controls are your best bet here. For instance, here is a video of a telescope build by Jillian Callahan from Burning Life a couple of years ago, which takes over somebody's view when they sit down: http://vimeo.com/103401
_____________________
http://ordinalmalaprop.com/forum/ - visit Ordinal's Scripting Colloquium for scripting discussion with actual working BBCode!

http://ordinalmalaprop.com/engine/ - An Engine Fit For My Proceeding, my Aethernet Journal

http://www.flickr.com/groups/slgriefbuild/ - Second Life Griefbuild Digest, pictures of horrible ad griefing and land spam, and the naming of names
Rygel Ryba
Registered User
Join date: 12 Feb 2008
Posts: 254
02-23-2008 15:19
Thanks everyone. I'll figure something out. I should have researched it more before I started. I just thought a heads up display was something that kept you from having to look down at the thing you were using. lol
Very Keynes
LSL is a Virus
Join date: 6 May 2006
Posts: 484
02-24-2008 03:08
From: Ordinal Malaprop
No, you can't sit on an attachment, or attach something that's being sat on. (Just try to imagine how that would work!)


I don't have to imagine it, It is called "Hair up your Butt on TP" syndrome :)