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.

Run script with mouse click

Featured Replies

Hello

Is it possible to run a script by clicking with the mouse?

I have made scripts for voice controlling GSX.  I call mechanic and stewardes by using the voice control function along with audio files for their replies.

I can activate their response by making a script for the mech and fwd cabin buttons and assigning it to my hardware.  My question is, can i initiate their response by actually clicking calls button on the overhead panel?

Thanks in advance

  • Commercial Member
4 minutes ago, arpal said:

My question is, can i initiate their response by actually clicking calls button on the overhead panel?

Depends on what the buttons do. You need to hook into the resulting code, event or variable change. 

Any concrete example?

LORBY-SI

  • Author

Yes, i want to use the "mech" or "fwd" calls buttons on the overhead panels of the Fenix A320.  

  • Commercial Member

Couldn't say off the top of my head, I will take a look at the behavior code associated with those buttons tonight. But I doubt that they do anything useful. Maybe they have an LVar associated to them that controls the visual animation of the button going in and coming out? Then you could implement an autoscript that looks for a change in that variable. Or you add something like that or maybe a custom K: event yourself to the behavior code of those buttons?

What is always possible is that you create an AAO gauge or web page with clickspots and display that in the sim, like this for example:

Streaming the StreamDeck (for example to VR) - AxisAndOhs Support - The AVSIM Community

Edited by Lorby_SI

LORBY-SI

  • Commercial Member

OK, so Fenix has kind of a strange strategy here, which in this case is very helpful. The buttons you mention have an LVar associated to them, that is counting up every time you click/release on that button. And the animation (the button going in or out) is triggered on every second change.

So to make something happen in AAO when you click on a button, you have to establish autoscripts that track changes to that variable, and then call up your own scripts when that change happens.

The autoscript would look for example like this (this is the code for one single script, it handles two variables at the same time):

(L:S_OH_CALLS_MECH, Number) (L:MY_S_OH_CALLS_MECH) - 1 > if{ (L:S_OH_CALLS_MECH, Number) (>L:MY_S_OH_CALLS_MECH) 1 (>K:mygroup-mymechscript) } 
(L:S_OH_CALLS_FWD, Number) (L:MY_S_OH_CALLS_FWD) - 1 > if{ (L:S_OH_CALLS_FWD, Number) (>L:MY_S_OH_CALLS_FWD) 1 (>K:mygroup-myfwdscript) } 

"if the difference between the sim variable and my local variable is bigger than 1, then write the simvar into my local var and call my scripts"

This script you assign as an Aircraft Automated Script, repeating, 100ms (or lower, depends how well it works).

Be mindful that I haven't tested this yet, this is off the top of my head after looking at the Fenix behavior code. 

 

Edited by Lorby_SI

LORBY-SI

  • 2 weeks later...
  • Author

Ok, forgive my limited knowledge.  I am trying to do this but i am a little confused

I want to run a script when the button is pressed.  

the button has the following LVAR: S_OH_CALLS_MECH

the script i want to run is" mygroup-mymechscript

What is MY_S_OH_CALLS_MECH  ?

🙂

  • Commercial Member

 

44 minutes ago, A320SimPilot said:

I want to run a script when the button is pressed.  

And my last post describes how to do that in this particular case, using a Automated Script that calls your own scripts when the button in the cockpit is pressed (=when its LVar changes). It even describes the logic in pseudocode - there is not much more than I can do?

44 minutes ago, A320SimPilot said:

What is MY_S_OH_CALLS_MECH  ?

The "MY_" are invented LVars to save the value of the variable that is connected to the button, so AAO can detect a change.

 

Edited by Lorby_SI

LORBY-SI

  • Commercial Member
43 minutes ago, A320SimPilot said:

Ok, forgive my limited knowledge.  I am trying to do this but i am a little confused

 

If you have trouble understanding how it works, don't try. Be mindful that this is a very complex request, under normal cicumstances (=in any other aircraft than the Fenix) it would be completely impossible. But you may be lucky with the Fenix because of the way that the developers implemented their buttons.

Just create an autoscript with the code above and replace the two (>K:...) calls with your own scripts (>K:groupname-scripttitle). Or just use the one line that you need in the autoscript. I've added two because you requested two in your OP.

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.