Jump to content
The simFlight Network Forums

Lua display window size


Recommended Posts

Hello Pete,

Using the "ipc.display" function in my Lua programs to

display a multi-line meassage, I find I have to resize the

Lua display window every time I load a flight in FSX.

Even though there is a section in my saved FLT files

that I assumed related to the position and size of the

Lua display window created by the "ipc.display" statement,

the window always begins at some default size which defeats

my formatting...2 lines listing various control functions

and a single line showing which control set is being displayed.

A sample of one of my Lua plugin lines:

ipc.display("MAGNETO INC 1 _ 2 _ 3 _ 4 _ INVERTER ON\nMAGNETO DEC 1 _ 2 _ 3 _ 4 _ INVERTER OFF\nControl Set = "..conset, 10)

Which should display as:

MAGNETO INC 1 _ 2 _ 3 _ 4 _ INVERTER ON

MAGNETO DEC 1 _ 2 _ 3 _ 4 _ INVERTER OFF

Control Set = 3

But instead displays as:

MAGNETO INC 1 _ 2 _ 3 _ 4 _ INVERTER

ON

MAGNETO DEC 1 _ 2 _ 3 _ 4 _

INVERTER OFF

Control Set = 3

When I resize the window it, of course, remains OK for the

duration of the flight but reverts to the default on the next flight.

Here are the sections of a couple of my saved flight FLT files:

FLT file saved from the FSX dropdown menu

with this section added by me:

[LUA display]
Undocked=False
ScreenUniCoords=3674, 923, 3347, 578
UndocCoords=0, 0, 0, 0

FLT file autosaved by FSUIPC with the

section included in the save by FSUIPC:

[LUA display]
Undocked=False
ScreenUniCoords=3674, 923, 3603, 461
UndocCoords=0, 0, 0, 0

Is there somewhere else that the default window size is specified?

Paul

Link to comment
Share on other sites

I find I have to resize the

Lua display window every time I load a flight in FSX.

It should auto-expand vertically to suit the number of lines you send. That is FS's doing, not mine. The width, though, is subject to user setting.

Even though there is a section in my saved FLT files

that I assumed related to the position and size of the

Lua display window created by the "ipc.display" statement,

the window always begins at some default size which defeats

my formatting.

Hmm. not sure how that works. I thought the same as you, that if you sized it and saved the flight it would come back the same when you reloaded that flight.

Here are the sections of a couple of my saved flight FLT files:

FLT file saved from the FSX dropdown menu

with this section added by me:

You shouldn't need to add it manually. I thought FS saved it in any case.

Is there somewhere else that the default window size is specified?

I don't know. Certainly not in anything of mine. FSUIPC simply calls FS routines for all this stuff.

What FS version are you using? I'll have to do some experiments. The same mechanism is also used for the Radar Contact window and the applications window facility used via the FSUIPC offsets -- that's it, 3 separately named FS windows which FSUIPC can handle at present.

Have you tried the undocked window? That saves separate size details in the FLT file I think.

Regards

Pete

Link to comment
Share on other sites

I find I have to resize the

Lua display window every time I load a flight in FSX.

It should auto-expand vertically to suit the number of lines you send. That is FS's doing, not mine. The width, though, is subject to user setting.

Yes, it does auto-expand vertically but that is not the issue. I would like to get

the default horizontal size to increase.

Here are the sections of a couple of my saved flight FLT files:

FLT file saved from the FSX dropdown menu

with this section added by me:

You shouldn't need to add it manually. I thought FS saved it in any case.

The FSUIPC autosave does include the Lua display parameters. The FSX save from the menu does not.

I added it to that FLT file in hopes that the window would be the desired size when I loaded

that saved flight. Alas, it was not.

Is there somewhere else that the default window size is specified?

I don't know. Certainly not in anything of mine. FSUIPC simply calls FS routines for all this stuff.

What FS version are you using? I'll have to do some experiments. The same mechanism is also used for the Radar Contact window and the applications window facility used via the FSUIPC offsets -- that's it, 3 separately named FS windows which FSUIPC can handle at present.

Have you tried the undocked window? That saves separate size details in the FLT file I think.

Regards

Pete

I am using FSX Accelleration with the latest rev of FSUIPC ( registered ) on WinXP Pro.

I am hoping not to have to use the undocked feature as I want the display to disappear

after the 10 second time in the display statement. This window is a "reminder" as to

which controls are currently mapped to my Saitek dual throttle quadrant switches.

I'll try specifying "undocked" as a test, however.

I have 7 different sets of assignments so I need the "cheat sheet display".

I use the FSUIPC logging function to display location 66C0 in the title bar.

When I hit my incr/decr "Control Set" switches, I change the value in 66C0.

This is my index for the 7 sets of control mappings.

Thanks for including the capability to display a variable in the title bar!! :)

Paul

Link to comment
Share on other sites

Yes, it does auto-expand vertically but that is not the issue. I would like to get

the default horizontal size to increase.

Yes, I understand that. I'm not sure how to do it automatically though.

The FSUIPC autosave does include the Lua display parameters. The FSX save from the menu does not.

That's really strange because the autosave is calling the exact same routine as you do when you manually save. There's never been any difference shown before.

I am using FSX Accelleration with the latest rev of FSUIPC ( registered ) on WinXP Pro.

I'll try some experiments with FSX then.

I am hoping not to have to use the undocked feature as I want the display to disappear

after the 10 second time in the display statement.

Doesn't the undocked one disappear when you want it to?

Really, the possibilities of the FS window facilities have not been explored much in the directions you are asking. I was trying for ages to get different font colours and sizes, and background colouring, all to no avail. There are some parameters I don't yet understand so all I can do is experiment a bit and see what I can dig up. I can't promise anything.

Regards

Pete

Link to comment
Share on other sites

... all I can do is experiment a bit and see what I can dig up. I can't promise anything.

Strange. I think there's an occasional bug in FSX, because it does always use the screen position values from the FLT file, but not always the size. This is different from FS9 where it always seems to use both position and size!

It isn't consistent. Sometimes when I load a flight and open a Lua window, it is the right width and length, sometimes only the right width, and sometimes default width and length.

If it isn't a bug in FSX then I can only think that it needs more data in the structure I'm providing -- i.e. a larger one -- and the results depend on what is in the memory after it. However, tracing through the FSX code doesn't seem to indicate this can be true.

I'll carry on looking at this for a little while, but I'm not sure it will lead to anything. Maybe I can add a Lua facility to specify the size instead, though I'm not sure that's possible either, yet ...

Incidentally, I cannot reproduce your problem of the Window data not being saved when you save a flight manually -- it always saves here, 100%. Maybe you don't have the Window active at the time you do the save?

Regards

Pete

Link to comment
Share on other sites

I've added two new commands to the Lua ipc library:

state, x, y, cx, cy = ipc.getdisplay()

This returns 5 values:

state = 0 for no display, 1 for docked display, -1 for undocked display

x, y are the screen coordinates for the top left

cx, cy are the display sizes, horizontal and vertical, respectively

ipc.setdisplay(x, y, cx, cy)

Sets the current display to a new position and size.

You should normally get the details, modify the values, and set the values, but if you know exactly what coordinates and size you want, then you can simply use setdisplay.

Note that there is only ever one Lua display window, and any Lua plug-in can use these commands -- so you could have a separate plug-in to set specific sizes and placements. It doesn't have to be done inside the one currently using the display.

These changes are in the latest incremental updates to FSUIPC3 and 4 -- version 3.971 and 4.587, available now.

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.