Jump to content
The simFlight Network Forums

PMDG 777X Open Door with LUA


Recommended Posts

Hello there,

need a little Help or a Code Example for opening Doors on the PMDG 777X only by LUA-Script. I don't want to use Keys or Buttons to do that.

In Example, the MainEntry1L should be opened, at the Moment, the GSX Stairway Car is placed. Could anbody please help, solving this Issue? Only the Code for opening the Door is needed. I am familiar with the Readout of GSX LVARS.

Thanks in Advance

Joachim

Link to comment
Share on other sites

44 minutes ago, Airbuspilot said:

Help or a Code Example for opening Doors on the PMDG 777X only by LUA-Script. I don't want to use Keys or Buttons to do that.

Are doors on the 777X operated by other than the standard FS "toggle aircraft exit" control?

Pete

 

Link to comment
Share on other sites

Hello Pete,

thanks for your fast Reply. Afaik, yes. Only the Entry1L could be opened with the FS Door Toggle. Especially on the Freighter the Main Cargo Door could'nt be operated by FS Door Toggle Commands. Seems, this is only possible over the Menu key in the CDU. 

Here is my Lua Code, that should open the Main Cargo Door.

   DoorStateCM = ipc.readLvar("L:7X7XmaincargoDoor")
   if DoorStateCM == 0 then
       ipc.writeLvar("L:7X7XmaincargoDoor", 100)
   end 
If i execute this, the Door will flicker between open and Close. Do you have any Idea, what is wrong with that Code? Thanks again for your Help.

Joachim

Link to comment
Share on other sites

10 minutes ago, Airbuspilot said:

If i execute this, the Door will flicker between open and Close. Do you have any Idea, what is wrong with that Code?

No, sorry. I don't have any PMDG aircraft and have no idea what their L:Vars do, if anything.

10 minutes ago, Airbuspilot said:

Only the Entry1L could be opened with the FS Door Toggle.

Are you sure using the toggle with a parameter value doesn't select other doors? On most aircraft you can have separate doors open/close with parameters 1 (same as omitted), 2, 3 and 4.

Also, I thought that most every aspect of both the 737NGX and the 777X could be operated using the "custom controls" added by PMDG. There's a list in the .h document in the aircraft's SDK folder. I'v just found a copy of the older 737NGX file and it definitely contains these defined controls:

#define EVT_DOOR_FWD_L                                (THIRD_PARTY_EVENT_ID_MIN + 14005)
#define EVT_DOOR_FWD_R                                (THIRD_PARTY_EVENT_ID_MIN + 14006)
#define EVT_DOOR_AFT_L                                (THIRD_PARTY_EVENT_ID_MIN + 14007)
#define EVT_DOOR_AFT_R                                (THIRD_PARTY_EVENT_ID_MIN + 14008)
#define EVT_DOOR_OVERWING_EXIT_L                    (THIRD_PARTY_EVENT_ID_MIN + 14009)
#define EVT_DOOR_OVERWING_EXIT_R                    (THIRD_PARTY_EVENT_ID_MIN + 14010)
#define EVT_DOOR_CARGO_FWD                            (THIRD_PARTY_EVENT_ID_MIN + 14013)  // note number skip to match eDoors enum
#define EVT_DOOR_CARGO_AFT                            (THIRD_PARTY_EVENT_ID_MIN + 14014)
#define EVT_DOOR_EQUIPMENT_HATCH                    (THIRD_PARTY_EVENT_ID_MIN + 14015)
#define EVT_DOOR_AIRSTAIR                            (THIRD_PARTY_EVENT_ID_MIN + 14016)

I should think the 777X would have something similar defined.

Pete

 

Link to comment
Share on other sites

Yes, there is something similar in the 777X SDK Folder. Unfortunally, i don't know, how to put this in a LUA Code, similar to my above given Example. Do you have a Hint for me please, how to realize i.E.  (THIRD_PARTY_EVENT_ID_MIN + 14005) in a LUA-Code Line?

Thanks in Advance

Joachim
 

Link to comment
Share on other sites

2 minutes ago, Airbuspilot said:

Yes, there is something similar in the 777X SDK Folder. Unfortunally, i don't know, how to put this in a LUA Code, similar to my above given Example. Do you have a Hint for me please, how to realize i.E.  (THIRD_PARTY_EVENT_ID_MIN + 14005) in a LUA-Code Line?

Just compute the number it states! The value of "THIRD_PARTY_EVENT_ID_MIN" will have been defined at the start of the list. This number is the "base" number it is using to separate all these controls from those used by FS (as listed in the List of Controls installed in your FSUIPC Documents folder).

Then in Lua send it using the ipc.control function.

It might need a parameter -- probably one to open it and a different one to close it. You could try 1 to open and 0 to close to start with, but otherwise you'll need to read more or ask around.

Pete

 

Link to comment
Share on other sites

I know, how to use the ipc.control. With this one ipc.control(66695,1), i operate the Jetway, if there is one and the Aircraft is a Passenger Jet.

What i don't know, is how to compute the stated Number?

Maybe somebody could help me, to put this Information, token from the 777 SDK, together to a ipc.control Command?

#define THIRD_PARTY_EVENT_ID_MIN 0x00011000   // equals to 69632

and

#define EVT_DOOR_CARGO_MAIN        (THIRD_PARTY_EVENT_ID_MIN + 14024)

Thanks in Advance to anybody, who will help.

Joachim

Link to comment
Share on other sites

Don't need a Calculator to calculate it. Did it with my Brain and composed it to ipc.control(83656,1) The only Thing here is, that this did'nt have any Effect. Also trying with ,0 and ,2 and ,3 and ,4 and at least with ,5. Without any Success.

So, i thought, i had to calculate an other Way, i.E. by calculating in Hex or any other Prorammers Calculations. That's the Reason, why i asked.

Sorry for asking. I will try to find Solutions in other Forums. You can close this Topic.

Last but not least, i am not that dumb, that you maybe Think.

Link to comment
Share on other sites

31 minutes ago, Airbuspilot said:

Don't need a Calculator to calculate it. Did it with my Brain and composed it to ipc.control(83656,1) The only Thing here is, that this did'nt have any Effect. Also trying with ,0 and ,2 and ,3 and ,4 and at least with ,5. Without any Success.

I did say you might need to research elsewhere to get the right parameters. I know that some of the controls use a sort of "mouse status mask" as a parameter -- one which indicates whether left, right or middle button has been clicked, usually. I'm afraid I don't know much more about that, but I'm sure others must have worked things out so best to ask around.

You could look further into that .h file too, to see if the answers are buried there.. The older 737NGX one I have contains these:

#define MOUSE_FLAG_RIGHTSINGLE   0x80000000
#define MOUSE_FLAG_MIDDLESINGLE  0x40000000
#define MOUSE_FLAG_LEFTSINGLE    0x20000000
#define MOUSE_FLAG_RIGHTDOUBLE   0x10000000
#define MOUSE_FLAG_MIDDLEDOUBLE  0x08000000
#define MOUSE_FLAG_LEFTDOUBLE    0x04000000
#define MOUSE_FLAG_RIGHTDRAG     0x02000000
#define MOUSE_FLAG_MIDDLEDRAG    0x01000000
#define MOUSE_FLAG_LEFTDRAG      0x00800000
#define MOUSE_FLAG_MOVE          0x00400000
#define MOUSE_FLAG_DOWN_REPEAT   0x00200000
#define MOUSE_FLAG_RIGHTRELEASE  0x00080000
#define MOUSE_FLAG_MIDDLERELEASE 0x00040000
#define MOUSE_FLAG_LEFTRELEASE   0x00020000
#define MOUSE_FLAG_WHEEL_FLIP    0x00010000   // invert direction of mouse wheel
#define MOUSE_FLAG_WHEEL_SKIP    0x00008000   // look at next 2 rect for mouse wheel commands
#define MOUSE_FLAG_WHEEL_UP      0x00004000
#define MOUSE_FLAG_WHEEL_DOWN    0x00002000


You can use those, as they stand, as parameters. e.g 0x20000000 for single left click.

Look at the actual aircraft on screen. when you operate a switch is it one click for off, or left, and another for on or right?  This might give you a clue.

43 minutes ago, Airbuspilot said:

Sorry for asking. I will try to find Solutions in other Forums. You can close this Topic.

Nothing wrong with asking, and I only close topics if folks start becoming offensive. Why are you regretting asking? I'm trying to help as much as I can with a product I don't know. Maybe the PMDG forum would be more suitable?

44 minutes ago, Airbuspilot said:

Last but not least, i am not that dumb, that you maybe Think.

I don't think any such thing. You asked how to calculate the addition of two numbers, and I asked if in fact you really didn't know, because I did not believe you wouldn't know! Hence my surprise you asked!

You do read a lot which isn't there, don't you!? :-(

Pete

 

Link to comment
Share on other sites

On ‎02‎.‎10‎.‎2016 at 8:34 PM, Pete Dowson said:

I did say you might need to research elsewhere to get the right parameters. I know that some of the controls use a sort of "mouse status mask" as a parameter -- one which indicates whether left, right or middle button has been clicked, usually. I'm afraid I don't know much more about that, but I'm sure others must have worked things out so best to ask around.

You could look further into that .h file too, to see if the answers are buried there.. The older 737NGX one I have contains these:

#define MOUSE_FLAG_RIGHTSINGLE   0x80000000
#define MOUSE_FLAG_MIDDLESINGLE  0x40000000
#define MOUSE_FLAG_LEFTSINGLE    0x20000000
#define MOUSE_FLAG_RIGHTDOUBLE   0x10000000
#define MOUSE_FLAG_MIDDLEDOUBLE  0x08000000
#define MOUSE_FLAG_LEFTDOUBLE    0x04000000
#define MOUSE_FLAG_RIGHTDRAG     0x02000000
#define MOUSE_FLAG_MIDDLEDRAG    0x01000000
#define MOUSE_FLAG_LEFTDRAG      0x00800000
#define MOUSE_FLAG_MOVE          0x00400000
#define MOUSE_FLAG_DOWN_REPEAT   0x00200000
#define MOUSE_FLAG_RIGHTRELEASE  0x00080000
#define MOUSE_FLAG_MIDDLERELEASE 0x00040000
#define MOUSE_FLAG_LEFTRELEASE   0x00020000
#define MOUSE_FLAG_WHEEL_FLIP    0x00010000   // invert direction of mouse wheel
#define MOUSE_FLAG_WHEEL_SKIP    0x00008000   // look at next 2 rect for mouse wheel commands
#define MOUSE_FLAG_WHEEL_UP      0x00004000
#define MOUSE_FLAG_WHEEL_DOWN    0x00002000


You can use those, as they stand, as parameters. e.g 0x20000000 for single left click.

Look at the actual aircraft on screen. when you operate a switch is it one click for off, or left, and another for on or right?  This might give you a clue.

Nothing wrong with asking, and I only close topics if folks start becoming offensive. Why are you regretting asking? I'm trying to help as much as I can with a product I don't know. Maybe the PMDG forum would be more suitable?

I don't think any such thing. You asked how to calculate the addition of two numbers, and I asked if in fact you really didn't know, because I did not believe you wouldn't know! Hence my surprise you asked!

You do read a lot which isn't there, don't you!? :-(

Pete

 

No, normally, i do not read somethings, that are'nt there. But please understand my Point of View. When i ask for a Solution of a Problem, i did all i can before asking. I was very angry, when reading your Comment, if i am unable to add two Numbers. Let's calm down and forget it.

Meanwhile, i solved this Problem. The Value to open a Door on the PMDG772 is 100. The Values, i tried, were much to small to make the Doors Movement visible.

Joachim 

Link to comment
Share on other sites

  • 2 weeks later...
On 10/4/2016 at 4:20 PM, Airbuspilot said:

Meanwhile, i solved this Problem. The Value to open a Door on the PMDG772 is 100. The Values, i tried, were much to small to make the Doors Movement visible.

Ah, so it needs the percentage of door opening! How strange. I'm sure real aircraft don't have such control over the door! ;-)

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.