Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Mouse events

Featured Replies

I have a situation where the aircraft developer has only created a mouse event to operate a switch (actually a few switches) in the virtual cockpit. The mouse event(s) trigger the animation and set an Lvar value. However, changing the Lvar value does not operate the switch or generate the condition in the code for the switch to be active. The "M:event" is not showing up in MSFS Input events when trying to assign a button. Finally, the event/component is not displaying any other variables in the "Behaviors" tool in the dev SDK.

Below my questions is the actual code in question.

My questions:

- I am using TrackIR, how might that affect using virtual mouse to select the switch?

- Is there other ways of triggering the swtich beside virtual mouse that you might recommend trying?

Thanks

PS tried searching this forum with no joy.

    <Component ID="inverter_switch" Node="inverter_switch">
        <MouseRect>    
        <MouseFlags>LeftSingle</MouseFlags>
        <Cursor>Hand</Cursor>
        <TooltipID>INVERTER %((L:inverter_switch,enum) 1 == )%{if}OFF%{else}ON%{end}</TooltipID>
        <CallbackCode><Code>
                (M:Event) 'LeftSingle'  scmi 0 == if{ (L:inverter_switch,enum) 1 + 3 % (>L:inverter_switch,enum) }
        </Code></CallbackCode> 
        </MouseRect>
        <WWISE_EVENT>button_switch_generic</WWISE_EVENT>
    </Component>

Edited by hs118

My MSFS 2020 repaints: Flightsim.to - Profile of HStreet

Working on MSFS 2024 versions.

  • Commercial Member

How did you "change the LVar value"? This behavior code looks like it should be working when you replicate the same in AAO? Is that the entire code? What aircraft is this?

(L:inverter_switch, Number) 1 + 3 % (>L:inverter_switch, Number)

This looks like the switch has three positions? What the code actually does is counting up the LVar towards infinity and limit it to the desired range with the modulo operator. So setting the LVar to 0-1-2 from the outside might screw something else up, you have to use the same code in AAO as in the leftsingle mouse event.

For components that use the Asobo default switch logic I made this:

Solution for MSFS BR Norseman - Mouse-Only levers - AxisAndOhs Support - The AVSIM Community

 

Edited by Lorby_SI

LORBY-SI

  • Author
2 hours ago, Lorby_SI said:

How did you "change the LVar value"? This behavior code looks like it should be working when you replicate the same in AAO? Is that the entire code? What aircraft is this?

(L:inverter_switch, Number) 1 + 3 % (>L:inverter_switch, Number)

The aircraft is the Sim Skunk Works SF-260. I was setting the Lvar with a simple script to set the value eg "1 (>L:inverter_switch, Number)". 

Thanks for the link to forum post. Will take a look at it.

Edited by hs118

My MSFS 2020 repaints: Flightsim.to - Profile of HStreet

Working on MSFS 2024 versions.

  • Commercial Member
1 hour ago, hs118 said:

was setting the Lvar with a simple script to set the value eg "1 (>L:inverter_switch, Number)". 

That is not enough, this LVar has multiple values. You have to use the same code as the LeftSingle event. I've posted the RPN code above, just copy and paste it into a script and bind it to the button.

(L:inverter_switch, Number) 1 + 3 % (>L:inverter_switch, Number)

Edited by Lorby_SI

LORBY-SI

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.