Jump to content
The simFlight Network Forums

Safe free offset usage


Recommended Posts

Hi Pete, I recently created a small Lua script to control the Aerosoft Airbus X Extended throttle (FADEC) and rudder using FSUIPC.

The reason I'm writing to you, is because the script that controls the rudder is using a workaround which I'm not sure is actually safe, with regards to the FSUIPC offset ecosystem.

To make a long story short, as the Aerosoft Airbus X Extended is controlling the rudder in a way that makes it impossible to use the keyboard, after many attempts I found that the best way to force incremental rudder travel was to feed FSX via the Lua script through the additional FS control for the rudder (64103) when the users presses a key, then read the FSX rudder offset to add some more rudder input and so on until hitting the +/- 16383 boundary, which would mean the rudder is full to whatever position the user commanded. However, reading the rudder offset was a failure (I imagine due to Aerosoft's programming), and the only way to keep track of the rudder setting was to use a "free" offset to store the data (signed 32bit).

As you may imagine, I used the 0x66c0 offset.

Now, considering my workaround, how much of a bad practice is it when using such a "free" offset to store the rudder value and what ugly scenarios can you picture from the use of such? Should I change anything? use different offsets?

If you want to take a look at the scripts, you may find it here: http://bit.ly/VRULND

Thank you!

cheers

-E

Link to comment
Share on other sites

... the only way to keep track of the rudder setting was to use a "free" offset to store the data (signed 32bit).

From a Lua plug-in, and just as storage? Why not use the Lua global variable facility intended for such things? Look up the ipc.set and ipc.get functions. You use a named variable which can be accessed by other plug-ins. Just choose a name wisely so it won't clash with anyone else's.

Regards

Pete

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.