Jump to content
Sign in to follow this  
A320SimPilot

Run script with mouse click

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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  ?

🙂

Share this post


Link to post
Share on other sites

 

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

Share this post


Link to post
Share on other sites
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

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