Jump to content

Scripting Help? Sensor Attach Script.


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

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

Recommended Posts

Could any of you please help me with a scripting issue I'm having? 

I'm currently trying to create a script for a HUD that is able to detect when you walk up close to it and automatically attach to you/your screen. Similar to that of the HUD at Social Island when you very first log into SecondLife for the first time ever.

 

I currently have a script that plays a sound when you walk up to it, but I don't know how to get it to attach. Thanks!

Link to post
Share on other sites

to attach the same way as on Social Island then we need to use a scripted Experience on a parcel that has been allowed by the parcel owner, and the person we wish to attach our HUD too, is a member of our Experience

a example of how attachment is done with an Experience is here: http://wiki.secondlife.com/wiki/LlRequestExperiencePermissions

for non-Experience attachment then start here: http://wiki.secondlife.com/wiki/LlAttachToAvatar

  • Like 2
Link to post
Share on other sites

Adding to @Mollymews excellent answer.

If you do not use Experience, you make a simple detecting prim with your sensor to rezz the HUD ( using llRezAtRoot() )and let it attach to the person who you detected. It is a good idea to make a time out for the HUD for example 60 seconds and let it die, if the person do not attach the HUD for what ever reason she/he has.

Use llAttachToAvatarTemp() as this will not kludge the users inventory and the HUD will disappear by it self, when the user detach it or log out.

And always check llRequestPermissions(), do not assume any permissions are granted or persistent.

  • Like 1
Link to post
Share on other sites
14 hours ago, Rachel1206 said:

Use llAttachToAvatarTemp() as this will not kludge the users inventory and the HUD will disappear by it self, when the user detach it or log out.

Also you can have the hud detect when the avatar leaves the region, via the CHANGED event, and auto detach/delete when they do that if that is a desired action.  Having it auto detach/delete when the avatar leaves a general area is also possible but require a bit more coding :)

  • Like 1
Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 271 days.

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...