Jump to content

Mouselook separate controls


verygoodquestion
 Share

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

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

Recommended Posts

Hello, some vehicle question here. Is it possible to set controls section in the script separately for mouselook and how? I tuned the script in a third-person view and when I was satisfied it turned out that I completely forgot about the mouselook and this is just awful control now! why is this happening? however, I would like to save the settings for the third-person view. is this possible?

Link to comment
Share on other sites

Hard to tell what's going wrong without seeing the code, or getting a better picture of the expected behavior verses how it's misbehaving when you enter mouselook. Saying it's "just awful now" doesn't give us a lot of info to go on.

But if I were to hazard a guess, I imagine you might be getting tripped up by the fact that the left/right arrow keys behave differently when you enter mouselook. Normally they trigger the CONTROL_ROT_LEFT and CONTROL_ROT_RIGHT respectively (these turn your avatar). But when you're in mouselook, they instead trigger CONTROL_LEFT and CONTROL_RIGHT (these strafe your avatar). So if your script doesn't account for that, that could be your problem... But again, I don't know how your script is expected to work in third person, so I can't say for sure without more info.

In any case, yes, it's relatively simple to code your control event to behave differently when in mouselook or not. Use llGetAgentInfo to query the status of the target avatar and check the resulting bit field against the AGENT_MOUSELOOK constant. Separate your different control code with an IF ELSE statement.

integer x = llGetAgentInfo(llGetOwner());
if(x & AGENT_MOUSELOOK)
{
	//do mouselook control stuff
}
else
{
	//do non-mouselook control stuff
}

Edit: Oh, wasn't there also some kind of mouse steering for vehicles? I vaguely remember something about that, but can't seem to locate it on the wiki...

Edited by Fenix Eldritch
  • Like 2
  • Thanks 2
Link to comment
Share on other sites

1 hour ago, Fenix Eldritch said:

Hard to tell what's going wrong without seeing the code, or getting a better picture of the expected behavior verses how it's misbehaving when you enter mouselook. Saying it's "just awful now" doesn't give us a lot of info to go on.

But if I were to hazard a guess, I imagine you might be getting tripped up by the fact that the left/right arrow keys behave differently when you enter mouselook. Normally they trigger the CONTROL_ROT_LEFT and CONTROL_ROT_RIGHT respectively (these turn your avatar). But when you're in mouselook, they instead trigger CONTROL_LEFT and CONTROL_RIGHT (these strafe your avatar). So if your script doesn't account for that, that could be your problem... But again, I don't know how your script is expected to work in third person, so I can't say for sure without more info.

In any case, yes, it's relatively simple to code your control event to behave differently when in mouselook or not. Use llGetAgentInfo to query the status of the target avatar and check the resulting bit field against the AGENT_MOUSELOOK constant. Separate your different control code with an IF ELSE statement.


integer x = llGetAgentInfo(llGetOwner());
if(x & AGENT_MOUSELOOK)
{
	//do mouselook control stuff
}
else
{
	//do non-mouselook control stuff
}

Edit: Oh, wasn't there also some kind of mouse steering for vehicles? I vaguely remember something about that, but can't seem to locate it on the wiki...

Hello! Thank you so much! Thats exactly what i needed!

Yes indeed there is mouse steering option, but i am thinking to get rid of it since i rarely use it. It looks like that now:

    if(level & edge & CONTROL_ML_LBUTTON)
    {
        if(mouse)
        {                
        mouse = FALSE;
        llOwnerSay("Mouselook steer OFF. ");
        llRemoveVehicleFlags(VEHICLE_FLAG_MOUSELOOK_STEER);
    }
    else
    {
            mouse = TRUE;
            llOwnerSay("Mouselook steer ON. ");
            llSetVehicleFlags(VEHICLE_FLAG_MOUSELOOK_STEER );
        }
    }

///...

    if(mouse && !(llGetAgentInfo(llAvatarOnSitTarget()) & AGENT_MOUSELOOK))
    {
        mouse = FALSE;
        llRemoveVehicleFlags(VEHICLE_FLAG_MOUSELOOK_STEER );
        llOwnerSay("Mouselook steer OFF. ");
    }

 

  • Like 1
Link to comment
Share on other sites

Ah, yes it was the vehicle flag I was half remembering. I'm not very familiar with that, so others may be able to provide better advice.

However if you intend to remove it completely, I believe you don't need to continually turn it off in the control event. Instead, you can set/remove the flag once at the beginning in something like the state_entry and then leave it be.

Link to comment
Share on other sites

3 hours ago, verygoodquestion said:

Hello, some vehicle question here. Is it possible to set controls section in the script separately for mouselook and how? I tuned the script in a third-person view and when I was satisfied it turned out that I completely forgot about the mouselook and this is just awful control now! why is this happening? however, I would like to save the settings for the third-person view. is this possible?

If the mouse controls the vehicle while in mouselook the way most ACS script-kit vehicle creators do it... I'm not gonna buy any of your stuff. I'm not saying it's bad or it's wrong or anything like that whatsoever. Though, do be very clear in your pre-sales descriptions that you are using that function and (or) provide a pre-sales demo that someone can drive. I like to go into mouselook and actually look out the windshield and turn my head and look around or look down at the dashboard, etc. while driving or flying or sailing or railroading... Just saying, as some feedback from a potential customer. :)

  • Confused 1
Link to comment
Share on other sites

12 minutes ago, Alyona Su said:

If the mouse controls the vehicle while in mouselook the way most ACS script-kit vehicle creators do it... I'm not gonna buy any of your stuff. I'm not saying it's bad or it's wrong or anything like that whatsoever. Though, do be very clear in your pre-sales descriptions that you are using that function and (or) provide a pre-sales demo that someone can drive. I like to go into mouselook and actually look out the windshield and turn my head and look around or look down at the dashboard, etc. while driving or flying or sailing or railroading... Just saying, as some feedback from a potential customer. :)

I am not gonna sale it, a specially to you. Do you ever say something good or useful on this forum?

  • Like 1
  • Confused 1
Link to comment
Share on other sites

6 minutes ago, verygoodquestion said:

I am not gonna sale it, a specially to you. Do you ever say something good or useful on this forum?

I've just expressed how a "mouslook driver" prefers how to do it. That should be useful, regardless whether you choose to implement that or not. I speak frankly and plainly, any emotion or mood you choose to insert into my words is on you, not me. :)

  • Like 1
  • Sad 1
Link to comment
Share on other sites

On 11/12/2019 at 11:46 AM, Alyona Su said:

If the mouse controls the vehicle while in mouselook the way most ACS script-kit vehicle creators do it... I'm not gonna buy any of your stuff. I'm not saying it's bad or it's wrong or anything like that whatsoever. Though, do be very clear in your pre-sales descriptions that you are using that function and (or) provide a pre-sales demo that someone can drive. I like to go into mouselook and actually look out the windshield and turn my head and look around or look down at the dashboard, etc. while driving or flying or sailing or railroading... Just saying, as some feedback from a potential customer. :)

Mine allow you o do just that - or shoot a gun ...or aim and shoot a turret while driving ... or just look at the bird poop on your side windows ...

Link to comment
Share on other sites

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

×
×
  • Create New...