Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Enter Mouselook Event Question

Jackson Shatner
Registered User
Join date: 5 Oct 2005
Posts: 8
02-10-2006 09:45
I've been attempting to script custom holding and aim animations into some weapons that I've modeled. I am up to speed on how to detect whether or not I'm in mouselook (do llGetAgentInfo on yourself), however my problem is that there is apparently no way for LSL to know when to do this check, because the actual activity of entering and exiting mouselook is mysteriously missing from LSL.

I've noticed in the average weapon script that somewhere between obtaining permissions (run_time_permissions event) and firing the weapon (control event) there seems to be a "hole" in the code where nothing is really happening, and it is in that "hole" that an agent enters and exits mouselook. Therefore, my question is this: is there any event that can be handled within the script regarding the entering or exiting of mouselook?

The only idea that I can come up with (haven't tried it yet) is making the script state-oriented and putting it into a "holding" state after permissions are set which constantly loops through the mouselook check, changing to an "aiming" state when mouselook is detected, then looping again to detect when mouselook is no longer active, whereupon the state is changed back to "holding".

If anybody has any ideas on this matter, I'd love to hear them, and I'll be trying the above state-oriented approach later this afternoon.
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
02-10-2006 11:42
From: Jackson Shatner
The only idea that I can come up with (haven't tried it yet) is making the script state-oriented and putting it into a "holding" state after permissions are set which constantly loops through the mouselook check, changing to an "aiming" state when mouselook is detected, then looping again to detect when mouselook is no longer active, whereupon the state is changed back to "holding".
That's basically it. That's what (for example) other animation overriders do. If you check every second, that should be plenty of time... if the control hits before that second is up you can even play a slightly different animation for a "snap shot" rather than an "aimed shot", and make a virtue out of necessity. :)