Jump to content
Sign in to follow this  
Sybull

Help with setting and using variables.

Recommended Posts

  • I am trying to use x-touch mini to increase/Decrease the panel lighting on the Just Flight PA28 Arrow 3 (3rd part addon aircraft)

By using the Developer mode I can see 2 "variables" increase and decrease in the window when I rotate the panel light switch in the cockpit using the mouse.

The 2 Variables are
(L:Panel_light_scaler,·Number) which increases in steps of .1
(L:CENTRE_LOWER_panel_light,·Number) which increases in steps of 1

My original thought was do have a script run that increments both these variables
(L:Panel_light_scaler,·Number)·.1·+·(>K:Panel_light_scaler,·Number)·(L:CENTRE_LOWER_panel_light,·Number)·1·+·(>K:CENTRE_LOWER_panel_light,·Number)

Pressing TEST does seem to increase the  variables as the second line shows (lets say the developer window is showing the variables at .1 and 1):
0.2 (>K:Panel_light_scaler,·Number) 2 (>K:CENTRE_LOWER_panel_light,·Number) . I am was assuming this line will send the 2 values to each variable. If there was an error in my code the 2nd line wouldn't appear I asume.

I set up a Button assignment so the "KEY DOWN EVENT" calls the script and the assigned button is the rotary knob on the x-touch

But nothing happens in the sim. The variables showing in the developer window don't charge either when I rotate the knob

Am I on the right track or is it going to be more complicated than that ? I feel I am getting the fundamentals of the syntax wrong.

Edited by Sybull

Share this post


Link to post
Share on other sites
29 minutes ago, Sybull said:

(L:Panel_light_scaler,·Number)·.1·+·(>K:Panel_light_scaler,·Number)·(L:CENTRE_LOWER_panel_light,·Number)·1·+·(>K:CENTRE_LOWER_panel_light,·Number)

That is not how this works. The K: events are a different (hard-coded) asset in MSFS, you cannot use them in this context.

Just write the desired value back to the variable, the "(>" is the "setter" method for all variables (L:, A:, C:, E:). 
(L:Panel_light_scaler,·Number)·0.1·+·(>L:Panel_light_scaler,·Number)

Maintain proper syntax (spaces, 0.1 not just .1 etc.) AAO is not the least bit forgiving.

I would test the two variables separately, to find out if you really need to operate both. Then you need to find the min/max boundaries of the variables, most models are allergic to variables leaving their comfort zone.

So in this case you just increment the variable and write the result back to it, and check if something happens in the sim. If it doesn't, try using both, but I somehow doubt that this is really how it works. 

(L:Panel_light_scaler,·Number)·0.1·+·(>L:Panel_light_scaler,·Number)

(L:CENTRE_LOWER_panel_light,·Number)·1·+·(>L:CENTRE_LOWER_panel_light,·Number)

And when you found out about maximum and minimum values, include that in the script.
Example: assuming the max value of the first LVar is 1.0 and the minimum is 0, then you would do this:

(L:Panel_light_scaler,·Number)·0.1·+·1·min·(>L:Panel_light_scaler,·Number)

(L:Panel_light_scaler,·Number)·0.1·-·0·max·(>L:Panel_light_scaler,·Number)

Edited by Lorby_SI
  • Like 1

LORBY-SI

Share this post


Link to post
Share on other sites

Well, That worked . Turns out it was just L:CENTRE_LOWER_panel_light that  needs changing and kept in the range 1-9👍

Applied my new found knowledge to set the Nav instrument lights. 👍

But then I tried the Cabin light. I found the Variable, saw that in increased in steps of 5 and ranged from 0-100. Applied it . I can see the variable go up and down when I twiddle the knob but the light doesn't dim/brighten in the sim.

(L:LIGHTING_CABIN_0,·Number)·5·+·100·min·(>L:LIGHTING_CABIN_0,·Number)

When I use the knob in the cockpit with the mouse the same variable changes and it does dim/brighten the light.

I went to the Modelbehaviourdebug window and looked under the "InputEvents" tab and found 2 bindings LIGHTING_CABIN_0_inc and LIGHTING_CABIN_0_dec. Executing these in the debug window has the desired effect on the sim

I assumed I could find these 2 events in AAO, but nope. I found some event that looked like  it might be it and hoped I could simply pass the variable to it after increasing/decreasing it

(L:LIGHTING_CABIN_0,·Number)·5·+·100·min·(>L:LIGHTING_CABIN_0,·Number)·(L:LIGHTING_CABIN_0,·Number)·(>K:CABIN_LIGHTS_POWER_SETTING_SET)

That didn't work either. 

Any tips on where/how to find the missing piece of the puzzle ? 

 

 

 

Share this post


Link to post
Share on other sites
7 hours ago, Sybull said:

Any tips on where/how to find the missing piece of the puzzle ? 

Those are probably B: variable input events. These cannot be operated from the outside. Asobo has introduced those assets in SU5. They are obviously a great help to the aircraft developers, but not so much for people who want to use external controllers.

Several threads have been started about this in the official forums, but there has been no commitment by Asobo to make those assets accessible.

That being said, the next version of AAO will include a hack to operate BVars anyway, since there is no indication that the situation will change with SU6.

Edited by Lorby_SI
  • Like 1

LORBY-SI

Share this post


Link to post
Share on other sites

Good to know you are keeping up with the the "challenges" that Asobo and Microsoft are offering . I hope this keeps your enthusiasm going to develop the software.

Plenty more button switches and knobs for me to play with and so much to learn within AAO, so I will leave the cabin lighting for a while.  

Keep up the good work and I look forward to future updates.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...