|
Jason Ayakashi
Registered User
Join date: 15 Nov 2006
Posts: 11
|
02-22-2007 12:15
Is there a way to detect when a user clicks the "Release Keys" button?
I've got an object that is user controlled (via llTakeControls) and it would be nice to know when they are done controlling it.
Thanks for any help!
|
|
RobbyRacoon Olmstead
Red warrior is hungry!
Join date: 20 Sep 2006
Posts: 1,821
|
02-22-2007 12:20
It would be best if the user had a way to specifically state that they were done, much like sheathing a sword or holstering a gun, where you script would specifically release the controls. The "Release Keys" button has the unfortunate side effect of blowing off your attachments that are using controls  That is, using that button frequently results in the detaching of said attachment, at least in the case of HUD attachments with control notifications.
|
|
Jason Ayakashi
Registered User
Join date: 15 Nov 2006
Posts: 11
|
02-22-2007 12:48
From: RobbyRacoon Olmstead It would be best if the user had a way to specifically state that they were done, much like sheathing a sword or holstering a gun, where you script would specifically release the controls. Ah, ok. Is there a way for me to remove the Release Keys button and replace it with one that I can trap to do the right thing?
|
|
Gaius Goodliffe
Dreamsmith
Join date: 15 Jan 2006
Posts: 116
|
02-22-2007 19:24
There's no way to get rid of the Release Keys button. As for providing a way for users to indicate they're done using the object, there's many different ways to do that. Without knowing what the object is and how it's controlled, I couldn't even hazard a guess as to what might be the best way to do it in your case. For my own part, most of my objects that use llTakeControls do so when you "sit" on them, so I release controls when they stand up. For an object someone attaches, you probably want to trap the attach event and detect when they detach it. If it's a HUD attachment, you can provide an actual button. For an object someone just clicks on in-world, you might want to detect them clicking on it again, or provide a second object they click on to stop. I'm sure I've missed about half a dozen other possibilities, depending on what the object is and does. Ultimately, it's entirely up to you how you want to handle it.
|
|
Rico Rosse
Registered User
Join date: 16 Jan 2007
Posts: 3
|
02-25-2007 16:07
My hack involves using a timer to check permissions changes, thus indicating Release Keys pressed.
===
integer iPermissionsCurrent; integer iPermissionsNeeded;
...
run_time_permissions(integer permissions) { iPermissionsCurrent = permissions; if ( iPermissionsCurrent == iPermissionsNeeded ) { llTakeControls(CONTROL_ML_LBUTTON, TRUE, FALSE); //Set timer to check if user released controls llSetTimerEvent(1.0); } }
...
timer() { //Check if user released controls, revert to default state iPermissionsCurrent = llGetPermissions(); if ( iPermissionsCurrent != iPermissionsNeeded ) { state default; } }
===
|
|
Jason Ayakashi
Registered User
Join date: 15 Nov 2006
Posts: 11
|
02-26-2007 08:45
Thanks for the thoughts, folks! I'll give both of those a shot.
|