Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Welcome back...

 

I believe I have asked this question before and I do apologize for revisiting. However, there is something I cannot make work.

 

I use your button screen in WideFS. Thank you so much for the facility. I have just purchased the PMDG 777 for P3D. I have toggle buttons for chocks and external connections.

 

Chocks default to ON when the aircraft opens. You can then connect ground power, air start and A/C. 

 

If the chocks are removed, all external services are automatically disconnected. This puts me in a situation where the state of the button(s)...toggle ON, are out of sync with the aircraft.

 

Looking at the library, I see ipc.setbtnstate(btn, state) and ipc.setbtnstateonly(btn, state). I have a LUA script to remove the chocks. Is it possible to use one of the button state functions to change the state of the buttons that control the ground connections?

 

Example:

 

--remove chocks and toggle ground power button to off. Assume button in question is 177

if ipcPARAM == xx then

 

RemoveChocks()

ipc.setbtnstate(177, 0)

 

end

 

This does not work for me. I am sure I am missing something obvious. The library says 'WideFS only'. Perhaps this is telling me that the logic has to exist on the client machine. If so, I have no idea how to tell WideFS that a change has bee made on the main machine, and to invoke a lua script to change the button state. I don't even want to go there. I apologize if I am being thick, but I don't quite know what I need to do to make this work; or even if it is possible.

 

Thanks.

 

 

 

 

Posted

Looking at the library, I see ipc.setbtnstate(btn, state) and ipc.setbtnstateonly(btn, state). I have a LUA script to remove the chocks. Is it possible to use one of the button state functions to change the state of the buttons that control the ground connections?

 

Example:

 

--remove chocks and toggle ground power button to off. Assume button in question is 177

if ipcPARAM == xx then

 

RemoveChocks()

ipc.setbtnstate(177, 0)

 

end

 

This does not work for me. I am sure I am missing something obvious. The library says 'WideFS only'. Perhaps this is telling me that the logic has to exist on the client machine.

 

The setbtnstate functions operate in conjunction with the ButtonScreen facility, which is only provided in WideClient. That's why the Lua program must be running in the Client, not in the FS PC.

 

There is no reason why you cannot do what you do on the FS PC on the client instead. jYou could use one of the user offsets (0x66C0-0x66FF), as follows:

 

On the FS PC: 

if ipcPARAM == xx then
   RemoveChocks()
   ipc.writeUB(0x66C0,255)
end

On the WideClient PC:

function ChangeChocksToggle(off, val)
   if val == 255 then
      ipc.setbtnstate(177, 0)
      ipc.writeUB(0x66C0,0)
   end
end

event.offset(0x66c0, "UB", "ChangeChocksToggle")
Save that Lua in the same folder as WideClient and it will run automatically.
 
Pete

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.