Jump to content
The simFlight Network Forums
thedutchguy

Linking pmdg 737 NGX belt offset with p3dv4 belt offset

Recommended Posts

Hi, 

I'm completely new to offsets and have no idea if this is even possible. But is there a way i can link the belt offset of the pmdg737 ngx to the belt offset of p3dv4? 

So if the pmdg offset changes from 1 to 3 the p3dv4 changes from 1 to 2? I need this functionality in order for the application Sim Sounds to recognize the belt signs in the NGX. I have talked to it's developer and he says simsounds monitors the offsets

No smoking sign: FSUIPC 8 bit U: Offset 0x341C 
Seatbelt sign: FSUIPC 8 bit U: Offset 0x341D
 
and i want those to be coupled to the pmdg 
649E 1 BYTE COMM_NoSmokingSelector 0: OFF 1: AUTO 2: ON
649F 1 BYTE COMM_FastenBeltsSelector 0: OFF 1: AUTO 2: ON 

 can this be done? And how? 

 

Share this post


Link to post
Share on other sites

Hi,

it should be relatively straightforward to do this with a short Lua program. Check the lua documents and examples in your FSUIPC Documents folder.

Basically you want to write a function that monitors the pmdg offsets (using event.offset) and in your function you can update the P3D offsets.

Good luck!

Cheers,

John

 

Share this post


Link to post
Share on other sites

ok, i'm trying this now. but i'm stuck. i found the below piece of code on the forums and im just trying to get it to play the sound when i flick the switch. But it doesn´t do anything. i 'm purpusly just playing a sound because i want to build the code for checking the value first before adding the "changing the offset" part.  

function belts(offset,value)
    if value==2 then   
        sound.play(""C:\\\\Applause.wav"")  
    end
end
event.offset(0x649F, "UB", "belts")

any idea?!?

Edited by thedutchguy

Share this post


Link to post
Share on other sites

Is your lua script activated? You need to add it to the '[Auto]' section in your ini file, or program to activate on something. Please check the documentation.

Cheers,

John

 

Share this post


Link to post
Share on other sites

yes it is. and i checked the fsuipc log while running the sim,. no entry of the function so it's not running for some reason.  

Edited by thedutchguy

Share this post


Link to post
Share on other sites
24 minutes ago, thedutchguy said:

yes it is. and i checked the fsuipc log while running the sim,. no entry of the function so it's not running for some reason.  

You used Lua logging to check this? Or did you add an ipc.log line in the function?

Did you enable the 737NGX offset data by editing the 737NGX_Options.ini file, as described at the beginning of the PMDG offsets list provided?

Also check that this parameter in the FSUIPC5.INI file:

PMDG737offsets

is set to 'Yes', or 'Auto'. not 'No'.

If both are ok, add the offset to the Monitor (right-hand side of the FSUIPC Logging tab), to check if the offset value is changing.

Pete

 

 

Share this post


Link to post
Share on other sites

I used Lua Logging to check it. I temporarily enabled the lua script dynamic friction to check functionality of the logger. I see that lua script running as expected. I just don't see the belt scipt running. 

737NGX_options.ini is edited (was already done because i use fs2crew and it needs the enable broadcast enabled)

PMDG737offsets is in the fsuipc.ini file and set to Auto

Added the offset 649F to the monitor and enabled onscreen display to check it. Value changes as expected from 0 to 1 to 2 and vice versa. 

 

  

Share this post


Link to post
Share on other sites

excellent. That was the problem. And i have edited the code so it´s now working like a charm! thanks for the help guys! 

in case anyone´s looking for the code for this 

function Belts(offset,value)
    if value == 2 then      
    ipc.writeUW(0x341D,1)
  end
    if value == 0 then
    ipc.writeUW(0x341D,0)
  end    
end
event.offset(0x649F,"UB","Belts")

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

×

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.