Jump to content
The simFlight Network Forums

Recommended Posts

Posted

I am at the beginning of lua scripting. Sorry for my question. I did a lot of reading and trying, but without success.

I have a registered  FUSIPC vers 4.997, FSX:SE and its a Carenado Citation CJ2 aircraft. I'm trying to set the target altitude at 1000 increments.  At the moment, I trigger the file with a button press assignment via FSUIPC.  In the future I will running this with an rotary encoder via mobiflight. I do not clearly understand the parameter. I figured out, e.g. 5000 in the parameter field brings 5000 ft target altitude. In which form or style I have to fill in this value to make the 1000 increments with each button press or have I put the parameter value to the roatary encoder in the mobiflight assigment?

 

 

I have tried with this code

function Alt_Presel_inc ()
    a = ipc.readLvar("L:CUSTOM_AP_ALT_VAR_SET_ENGLISH") -- get the state of the Lvar
    ipc.writeUW("66C0", a) -- save the state of the Lvar in the offset 0x66C0
    a = a + 1000 -- add 1000 not sure if this is the right place
    end
    
event.Lvar("L:CUSTOM_AP_ALT_VAR_SET_ENGLISH", 100, "Alt_Presel_inc") -- monitoring the Lvar

 

Any advice would be very appreciated.

Best regards

Franz

 

 

 

FSUIPC4.ini Alt_Inc.lua

Posted
21 hours ago, wif said:

correction -- FSUIPC Vers. 4.976

The latest, and only supported version, is 4.977. I don't think there are any functional changes between these versions, just built using a later windows toolkit.

On 12/19/2022 at 1:48 AM, wif said:

function Alt_Presel_inc ()
    a = ipc.readLvar("L:CUSTOM_AP_ALT_VAR_SET_ENGLISH") -- get the state of the Lvar
    ipc.writeUW("66C0", a) -- save the state of the Lvar in the offset 0x66C0
    a = a + 1000 -- add 1000 not sure if this is the right place
    end
    
event.Lvar("L:CUSTOM_AP_ALT_VAR_SET_ENGLISH", 100, "Alt_Presel_inc") -- monitoring the Lvar

This is just writing the value of the lvar L:CUSTOM_AP_ALT_VAR_SET_ENGLISH to offset 0x66C0 each time the lvar value changes, as you are incrementing the value after writing it. If you just want to increment/decrement the lvar value by 1000, you don't want an event on the lvar... 

On 12/19/2022 at 1:48 AM, wif said:

At the moment, I trigger the file with a button press assignment via FSUIPC.  In the future I will running this with an rotary encoder via mobiflight. I do not clearly understand the parameter. I figured out, e.g. 5000 in the parameter field brings 5000 ft target altitude. In which form or style I have to fill in this value to make the 1000 increments with each button press or have I put the parameter value to the roatary encoder in the mobiflight assigment?

A rotary encoder normally uses either one or two buttons (one slow, one fast) in each direction, so is programmed the same as when using buttons. Or does it use an axis?

But I cannot help if assigning using MobiFlight - try the MobiFlight Discord channel for MobiFlight support.

John

Posted

If using FSUIPC for the assignment, you can use event.button (if the rotary uses buttons) and in the handling function, read the lvar value, increment/decrement it, an then write back/update the lvar to the new value. Not sure how you would do this if assigning in MobiFlight.

John

Posted

To start the function in FSUIPC with a key press and use the same key in mobiflight via the keyboard input. I use the FSX:SE Sim.

Franz

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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.