Jump to content
You are about to reply to a thread that has been inactive for 1540 days.

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

Recommended Posts

Posted

I am creating a game HUD. I need to make some updates to the players data structure in the main script. Is there a way to either catch a detach event when the user selects 'Detach' from the Pie menu for the HUD, or to disable the Detach from the Pie menu for this HUD and provide an 'X' on the HUD to detach? I would greatly prefer the former.

Thanks,

G

Posted

No, there really isn't.  I have often provided either an X or a Detach button (or a dialog button) as attractive alternatives to detaching from the UI or from the user's inventory, but there's no way to override those standard options.

Posted
1 hour ago, Rolig Loon said:

No, there really isn't.  I have often provided either an X or a Detach button (or a dialog button) as attractive alternatives to detaching from the UI or from the user's inventory, but there's no way to override those standard options.

Ok, thanks. I think I ran into something similar trying to catch an event from the Pie menu. :(

G

Posted (edited)

I believe the attach even fires on detach. id will equal NULL_KEY. The problem is, the script is only given a small amount of time after detach to execute code. So if there is a lot of work to do, you might be better to fire off a message to some other object on the region to do the work.

One annoying thing I ran into when doing this is the key of the source object (the one being detached) is no longer valid, so a receiver can't verify who sent the message with llGetOwnerKey(). The message itself needs to carry the owner info.

You aren't guaranteed to get time, and if you use this feature, take into account that you should use this in your attach handler to properly detect a detach, and not code continuing to execute from the previous detach.

if (id == NULL_KEY && llGetAttached() == 0) { safe to run detach code }

Edited by Phate Shepherd
  • Like 1
Posted

Phate,

Thanks, that works, at least to say a string to local for now. But all I need to do is to send a message using llRegionSayTo so the main object can unregister the player.

Should work fine.

 

G

Posted (edited)

I usually get to process two or three lines of simple code in the attach event when an object is detached. But be aware that any unprocessed code will resume where it left off when the object is reattached.

Edited by KT Kingsley
Posted
26 minutes ago, KT Kingsley said:

I usually get to process two or three lines of simple code in the attach event when an object is detached. But be aware that any unprocessed code will resume where it left off when the object is reattached.

Thanks,
G

You are about to reply to a thread that has been inactive for 1540 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
×
×
  • Create New...