Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hi,
what's the best practice to spoof reads of an offset variable?
Some fixed gear planes report always "gear down" and I don't want the gear down indicator on my panel lit when using those planes, so at the moment I have the following in the profiles' lua of the affected planes:

function spoof_gear(t)
    ipc.writeStruct(0x0024, "1UW", 0x0BEC, "1UW", 2, "1UW", 0)
    ipc.writeStruct(0x0024, "1UW", 0x0BF0, "1UW", 2, "1UW", 0)
    ipc.writeStruct(0x0024, "1UW", 0x0BF4, "1UW", 2, "1UW", 0)
end

function cleanup()
    ipc.writeStruct(0x0024, "1UW", 0x0BEC, "1UW", 0)
    ipc.writeStruct(0x0024, "1UW", 0x0BF0, "1UW", 0)
    ipc.writeStruct(0x0024, "1UW", 0x0BF4, "1UW", 0)
end

event.timer(1000, "spoof_gear")
event.terminate("cleanup")

I found offset 0x0024 and its usage in the offset list and I'm not sure if using a timer there is the best way, but the spoofed values always reset after a few seconds. I know there is event.offset that fires when an offset changes, is there also an event that fires on an offset read where you could spoof the read result? In the documentation I didn't see something like that...

jaxx

Posted
On 6/18/2020 at 11:55 AM, jaxx said:

is there also an event that fires on an offset read where you could spoof the read result? In the documentation I didn't see something like that...

No, there is no such function.

You are probably better off using a user offset to drive your gear light indicator (e.g. starting offset 66C0). You could have a lua script that simply copies the gear offsets (0BEC, OBF0, 0BF4) to this area if gear is retractable (offset 060C), or otherwise writes 0.

John

 

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.