Jump to content

How does llTakeControls work with multiple 'users' of it


Vulpinus
 Share

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

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

Recommended Posts

I'm working on a weapon script, which will sometimes be used along with a combat HUD (SPD-J right now, if it matters).

Both the HUD and my script need to use the same control events. For instance, the HUD needs to get an attack (CONTROL_ML_LBUTTON + an arrow key) and so does my script to play my custom animation, or not depending on the arrow key. There's more but basically similar to that.

How does llTakeControls work with regards to passing though (or not) the controls, if both my weapon and the HUD use llTakeControls? I know I could do a load of what-if tests, but I'm hoping someone can save me a few precious hours ;)

Specifically...

Does 'pass on' just refer to passing on the control event to the viewer? ( I guess it must; so other scripts can also get the same control inputs even if my script says not to pass them on)

Does just one script have to be set to 'pass on' for the viewer to get it, or would it not be passed on if just one script says not to?

Oh, and I so wish there was an 'entering/leaving mouselook' event. It would make things much easier. To make life more difficult, the weapon has both melee and projectile modes and needs to be used while flying (actually swimming) as well as walking.

Link to comment
Share on other sites

What you are doing sounds similar to making a remote-controlled vehicle or a drone, which I have done a few times.  You really only need a control event at one point -- the place where you are actually controlling something.  Write the control event to send its output to any other scripts as simple commands in chat or link messages.  The receiving scripts don't need to know that there is a control event somewhere else.  They just need to know what to do with a command that says "go up" or "spin clockwise".

If both your HUD and the weapon have control events, you'll have to convert one of them (probably the weapon) to a listen event.  If the weapon has specialized commands that the HUD does not have, you might need to put a "mode Switch" button on the HUD to tell the script to send commands to the weapon when that button is engaged.

Link to comment
Share on other sites

Unfortunately I don't think the HUD is that flexible by chat/listen. It does have some chat control which is useful to me (like turning off its own animations) but not to the extent of attack control. Of course, I have no access to the source code.

However, a few quick tests confirm that several attached objects can all receive the same control input, regardless of 'pass on' or not.

To my surprrise, if only one of them is set to not pass on, then the viewer does not get the control. In retrospect, I suppose that way makes more sense. If something is not passing on controls because it really does take control of movement itself (like your vehicles, or my still-in-beta swimming controller) then that should not be overridden by something else wanting to watch the controls.

So at the moment I think I can do what I want without interfering with the HUD functionality, or vice versa.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2325 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
 Share

×
×
  • Create New...