Jump to content
The simFlight Network Forums

FSUIPC Lua Plugin AS Airbus

Recommended Posts


After installing the new AS Airbus for P3D V4, I tried to load a Lua file to move the rudder with a joystick. This Lua plugin was made years ago by Enrique Vaamonde for the 32bit version of this aircaft. The plugin works well, but every time I press the buttons and the plugin is working I have hard stutters, (tried with gamepad and with keyboard keys also) only when it is applied.
It has something to do with the change of 32 to 64 environment? It needs some kind of modification inside the Lua file?

Many thanks



-- LUA Script for keyboard control of Aerosoft Airbus X Extended Rudder
-- Version 2012121901
-- (C) Enrique Vaamonde - evaamo at gmail.com

rudderSTEP = 2048
rudderPOS = ipc.readSW(0x66c0)
if rudderPOS > 16383
    then rudderPOS = 16383
if rudderPOS < -16383
    then rudderPOS = -16383
--ipc.display("RUDDER:  "..rudderPOS)

function rudder_set(value)
    ipc.writeSW(0x66c0, value)
    ipc.control(64103, value)

if ipcPARAM == 1 then

if ipcPARAM == 2 and rudderPOS < 16383
    then rudder_set(rudderPOS + rudderSTEP)

if ipcPARAM == 3 and rudderPOS > -16383
    then rudder_set(rudderPOS - rudderSTEP)


Link to comment
Share on other sites

On 7/12/2018 at 3:09 PM, Joan A said:

It needs some kind of modification inside the Lua file?


That seems correct. This particular script is a "run once", meaning each time the command is given to move the rudder the script also kills (  ipc.exit() ) itself then reloading on the very next command, and over & over...

Looking at the version number this was made back in 2012. Back then it was probably the only way to make this script work and is very inefficient. Similar to killing a windows program by using the Windows task manager and ending a process forcefully.

Since then Pete has incorporated event "listeners" where the script is loaded via [Auto] or [Auto.<profile>], it stays running, listening for commands. I am assuming a rewrite would help alleviating the stutters.

Here is a new script, not tested "yet" (a very busy morning) -

local rudderStep = 2048

local rudderPos = 0

function centerRudder(flag)
	ipc.writeSW(0x0BBA, 0)

function moveRudder(flag)
	rudderPos = ipc.readSW(0x0BBA)
	if flag == 2 then
		rudderPos =  rudderPos - rudderStep
		rudderPos = math.max(rudderPos, -16383)   
		rudderPos =  rudderPos + rudderStep
		rudderPos = math.min(rudderPos, 16383)
	ipc.writeSW(0x0BBA, rudderPos)

event.flag(1, "centerRudder") -- CENTER
event.flag(2, "moveRudder") -- MOVE LEFT
event.flag(3, "moveRudder") -- MOVE RIGHT

1) Get the lua running by either using [Auto], [Auto.<profile>] or a key command via the FSUIPC interface "Lua <lua name>"
2) Center rudder - Assign the command via the FSUIPC interface "LuaToggle <lua name>" with a parameter of 1, repeat is optional
3) Left rudder - Assign the command via the FSUIPC interface "LuaToggle <lua name>" with a parameter of 2, repeat is checked
4) Right rudder - Assign the command via the FSUIPC interface "LuaToggle <lua name>" with a parameter of 3, repeat is checked

Hopefully this works for you. Will test later this afternoon when I return.
If this new lua does not get rid of stutters then the AS Airbus is overloading simconnect in some fashion.



Edited by spokes2112
Updated to new code
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Hi Roman,

Many thanks, I didn't expect such a detailed explanation, even taking the time to modify the script. I would never have been able to do it myself. I really appreciate your help.
I've been using FSUIPC for some time and I experimented with offsets but I really do not know anything about deeper knowledge of the coding capabilities that it offers.
But I get what you are saying about the new efficient way of invoking it with events. 
I'll try tomorrow the script and let you know.

Thank you!

Link to comment
Share on other sites


You are welcome. I just hope I can help.
I am testing in FSX with the stock MS B737 and the original code above just did not work. 
It has now been updated with new code. Some really weird things going on.
Give that one a try instead. If the AS Airbus uses SDK compliant variables it should work. If they're using some highly custom coding then it may not..




Some really weird things going on here.. 

vers - 4.974b, tested on MS B738

0x0BBA - SW, Rudder control input: –16383 to +16383
0x0C0A - SW, Rudder input value, -16384 to +16383, if calibrated
0x332C - SW, Rudder Axis input value, post calibration, just before being applied to the simulation (if allowed to by the byte at offset 310A).

64103 - fsuipc rudder
65764 - rudder axis set 
65696 - rudder set

The joystick axis for rudder was removed in the axis assignment & joystick calibration pages to test - keep from interference.

1) The FSUIPC "internal" command 64103 doesn't seem to work at all regardless of any of the 3 read offsets listed above. (Big questions here!)
     Used at the end of function "moveRudder" -- ipc.control(64103, rudderPos) replacing the offset write as shown above, all other code was the same but trying all 3 read offsets.
2) The command 65764 is weird, for the 0x332C & 0x0BBA reads it seems the read gets reset to zero after the command, therefore travel is limited to -2048 to 2048.  The read at 0x0C0A just gave completely unreliable results altogether. 
3) With the command 65696, the reads at 0x0C0A & 0x332C seems the read gets reset to zero after the command, therefore travel is limited to -2048 to 2048, same as above with different reads while 0x0BBA gave completely unreliable results altogether. 

In the end just read & writes to 0x0BBA were used reliably...  (so confused!)



  • Thanks 1
Link to comment
Share on other sites

Hi Roman,

Thank you again, I tried it but it does not do anything. Maybe I'm doing something wrong, but after replacing the script, and adding the plugin to the [Auto] section the plugin does not work. No action is shown in the FSUIPC console when buttons pressed.
Just to add that with the original script the stutters were also happening with default aircraft. In fact I tried with one of the Lua plugin that comes with FSUIPC, the gradual braking and it also stutters when I trigger the button.
This is happening in fresh install of Win10 with last updates and fresh install of P3D 4.3.
It seems that all the Lua Plugins I try I have massive stuttering when applied. I'm going mad with this.

Thank you.

Link to comment
Share on other sites

Hi Joan,

Just retried the lua code above to see if there was a copy/paste problem. No - works fine.  Said before I am still on FSX with FSUIPC v4.974b, anyway there is a setting in this version to change the affinity mask for lua scripts - LuaAffinityMask=0 
It was stated in the history document for 4.974 but nowhere else, maybe consult your documents and see if it it is available for v5.xxx. If available maybe give it a try. 

Good luck with you


Link to comment
Share on other sites

Hi Roman,

Yes, it works! It does work with default aircraft without stuttering, but it behaves strangely with the AS Airbus, it works "partly", with FBW doing its stuff. Strange, because without events was working well despite stuttering.  I'll keep testing anyway.

Many thanks Roman, I really appreciated all of your help.

Link to comment
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
  • 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.