Jump to content

Recommended Posts

Posted

Hello everybody,

I am a new AxisAndOhs customer (I bought the software on JustFlight a couple days ago) trying to get a hold on scripting and assignments.
I read many posts here and found some (outated) tutorial on YT, but I am still missing some points.
As a first "easy" experiment I am trying to use a MIDI controller (a non-infinite rotary with 0-100 movement from a KONTROL Z1) to control the radio light dimming knob on the C152 (please see attachment, it's the upper knob in the middle of the screenshot).

I was able to get the radio lights dimming correctly with the movement of the MIDI pot with the script you see in the screenshot, and now I am trying to understand how to setup the script for the knob animation. I see a piece of code in the Behavior Dev mode window which I believe is what makes it move, but I am not sure how to "translate" it to make it work with AAO:

50 (>0:Knob_Position) (0:Knob_Position) 0.9000000 * 10.00000 + (>K:LIGHT_POTENTIOMETER_4_SET)

Any help would be appreciated! :)
Thank you!

spacer.png

Posted
11 hours ago, FloatingPoint said:

50 (>0:Knob_Position) (0:Knob_Position) 0.9000000 * 10.00000 + (>K:LIGHT_POTENTIOMETER_4_SET)

Correction, it's >O:Knob_Position, not >0:Knob_Position (it's a component variable I suppose):

50 (>O:Knob_Position) (O:Knob_Position) 0.9000000 * 10.00000 + (>K:LIGHT_POTENTIOMETER_4_SET)

I know I could use (>B:NAVCOM_Dimming_Inc) e (>B:NAVCOM_Dimming_Dec) to move the knob and dim the lights at the same time, but I couldn't find a way to make them work with a MIDI potentiometer keeping the position of the knob coherent with the position of the MIDI pot. The scope of this exercise is to use the pot as an axis, not as a button.

Thanks

Posted

As a further reference, this is ChatGPT's analysis of the script:

Script Breakdown:

1. `50 (>O:Knob_Position)`:
   - This appears to set the value `50` to the variable or local variable `O:Knob_Position`.
   - The `>` symbol typically suggests an assignment, directing the value on its left to the variable or function on its right.
   - `O:` is a prefix which often indicates a local or custom variable, in this case, `Knob_Position`. This variable likely represents the position or value of a specific knob in the simulator.

2. `(O:Knob_Position) 0.9000000 *`:
   - This retrieves the value of `O:Knob_Position` and multiplies it by `0.9000000`.
   - The result is a value that's 90% of the original `O:Knob_Position`.

3. `10.00000 +`:
   - This takes the previously calculated value and adds `10` to it.

4. `(>K:LIGHT_POTENTIOMETER_4_SET)`:
   - The calculated value from the previous steps is then assigned to the function or event `K:LIGHT_POTENTIOMETER_4_SET`.
   - The `K:` prefix often represents a predefined event or function within the simulator. In this case, it appears to be related to setting the value of a light potentiometer, possibly the fourth one if there are multiple.

Summary:

The script seems to be adjusting the value of a light potentiometer in the simulator based on the position of a knob. Specifically:

1. The knob's position is set to 50.
2. This position is then scaled down to 90% of its value.
3. 10 units are added to the scaled value.
4. The final calculated value is used to set the position or intensity of a light potentiometer in the simulator.

The exact physical or visual outcome would depend on how the simulator interprets and applies the `K:LIGHT_POTENTIOMETER_4_SET` event, but it's clear that the script is designed to adjust lighting based on a knob's position, with some scaling and offset applied.

  • Commercial Member
Posted (edited)

O: Variables cannot be accessed from the outside. In MSFS this is an object variable, valid only in the context of this specific button. The next button can have the same O:variable and they won't interfere.

If anything, all you can utilize from thsi script is the K - event, by selecting it on the AxisAssignment dialog, setting Axis Min to 0 and Axis Max to 100. But BVars are probably better

4 hours ago, FloatingPoint said:

I know I could use (>B:NAVCOM_Dimming_Inc) e (>B:NAVCOM_Dimming_Dec) to move the knob and dim the lights at the same time, but I couldn't find a way to make them work with a MIDI potentiometer keeping the position of the knob coherent with the position of the MIDI pot. The scope of this exercise is to use the pot as an axis, not as a button.

BVars don't have fixed names. Only the first part is the actual name, the "do-soemthing-word" at the end can usually be chosen to suit the use case.
Try n (>B:NAVCOM_Dimming_Set) with n being a value from 0 to 100 which you assign as Axis Min and Axis Max (probably, could be 0 to 1 as well). When it is 0 to 100, set rounding to "int". You can enter the BVar directly on the axis assignment dialog, no need for a script. Check the AAO manual about how to do this correctly.

Edited by Lorby_SI
  • Like 1

LORBY-SI

Posted
27 minutes ago, Lorby_SI said:

BVars don't have fixed names. Only the first part is the actual name, the "do-soemthing-word" at the end can usually be chosen to suit the use case.
Try n (>B:NAVCOM_Dimming_Set) with n being a value from 0 to 100 which you assign as Axis Min and Axis Max (probably, could be 0 to 1 as well). When it is 0 to 100, set rounding to "int".

Thanks a lot for the hint!
I tried, and the result is it increases by 4-5 units when the value is 1 (or more) and decreases by 4-5 units when it's 0. It doesn't transfer the assigned value to the knob directly.

Video showing the behavior: https://www.postfrontal.com/FS2020/dimmer.mp4

Any other idea? :)

  • Commercial Member
Posted (edited)
13 minutes ago, FloatingPoint said:

Any other idea? 🙂

No. Either use the K-Event or the BVar with the correct Axis Min and Max and Rounding setting. Maybe the value range is incorrect (that can be anything, 0-1, 0-10, 0-100 - whatever)

I can check later today, the video is too small for me to see anything. The first thing to find out is the actual input event that is in play here, using the MSFS developer mode and looking into the Mouse Event section of the behavior code of that knob. I'm not sure that your BVar is really correct.

Edited by Lorby_SI
  • Like 1

LORBY-SI

Posted

In the meantime, I tried on other knobs (B:NAVCOM_COM1_Volume_Set for example) and the system you suggested works like a charm. It doesn't work on the two knobs on top (VOL and DIM) for some reason, no matter which Axis min and Axis max I use.

Example of working knob:

spacer.png

 

Another question I have is: I noticed I can't access any information with CTRL+G in the Behavior panel for some items (the altimeter QNH setting knob for example on this specific plane). Is there any other way to access and work with those "ghost" variables?

Thanks

  • Commercial Member
Posted
3 hours ago, FloatingPoint said:

Is there any other way to access and work with those "ghost" variables?

use the "Component Search" field (in this case "alti" seems to yield results). Make sure that you have the correct model selected at the top. 

Or browse through the componentes using the drop down boxes.

But I am pretty sure that this knob uses the default K - Events (Kohlsman)

  • Like 1

LORBY-SI

  • Commercial Member
Posted
5 hours ago, FloatingPoint said:

Any other idea? 🙂

Use the (K:LIGHT_POTENTIOMETER_4_SET) event with Axis Min 0 and Axis Max 100. The knob in the cockpit does not animate, but the event should do its job just fine (=dim or increase the potentiometer)

  • Like 1

LORBY-SI

Posted
1 minute ago, Lorby_SI said:

Use the (K:LIGHT_POTENTIOMETER_4_SET) event with Axis Min 0 and Axis Max 100. The knob in the cockpit does not animate, but the event should do its job just fine (=dim or increase the potentiometer)

Yes, this was my first successful task before opening this post. I understood sometimes it's not easy to get both (effect + animation), but thanks to your hints I understood a lot more about how things work in the sim and already mapped multiple sliders and knob on my H125 helicopter perfectly! 

 

Thank you!

  • Commercial Member
Posted

Using a script you could fake the animation too, but I'm not sure that it would be worth the trouble. That knob doesn't designate any position or point at something, it just turns.

  • Like 1

LORBY-SI

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
  • 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...