Artem Crum Posted April 28, 2012 Report Posted April 28, 2012 Hello Pete, Is there any way to create and control multiline message window inside FSX via Lua script? I know, I can create two types of messages - the green scrolling line by sending data to special offsets and the "LUA display" box by using ipc.display() function. But can I create something like internal ATC window or at least Radar Contact's message box?
Pete Dowson Posted April 28, 2012 Report Posted April 28, 2012 I know, I can create two types of messages - the green scrolling line by sending data to special offsets and the "LUA display" box by using ipc.display() function. But can I create something like internal ATC window or at least Radar Contact's message box? Yes, please see the FSUIPC offsets list. Use offset 3380 (for the text) and 32FA (for the control). Multilined text is done by including new line or return codes in the text ("\n" or "\r" in strings, same as the byte values 10 and 13). This is what Radar Contact uses. You are limited to 127 character maximum, with a zero terminator. The Lua display facilities are actually a lot more user-friendly, but it's your choice. On a WideFS client you can use the Lua wnd library, and even control its size and position with the ext library. Regards Pete
Artem Crum Posted April 28, 2012 Author Report Posted April 28, 2012 Aha, I see, multiline is available with ipc.display() and "\n" code where needed. Thanks. The other wish is to control message window title, size and position. I was trying to set title by 0x6D60 offset, but it seems not working in the case of ipc.display(). And what about size and position?
Pete Dowson Posted April 28, 2012 Report Posted April 28, 2012 Aha, I see, multiline is available with ipc.display() and "\n" code where needed. For the ipc display library, why not use "ipc.linedisplay" instead? That gives you a complete line-oriented display capability. It's the one used in the examples supplied, like hidDemo and GFDdisplay lua programs. I use it for logging stuff too in many of my programs for my cockpit. The other wish is to control message window title, size and position. I was trying to set title by 0x6D60 offset, but it seems not working in the case of ipc.display(). That title is related to the offset 3380 text window. The Lua window has a fixed title. There's only one such Window in any case, shared by all Lua programs. And what about size and position? That's wht the ipc.setdisplay function is for! Pete
Artem Crum Posted April 29, 2012 Author Report Posted April 29, 2012 Am I always missing something obvious? :ph34r: Will try them both, thanks! BTW, it would be nice to have an ability to change the Lua window title. Even if it is only one window for all scripts, not all of them gonna use it at the same moment. And with title I could make it look more as part of the script, not just an abstract "Lua Display".
Pete Dowson Posted April 29, 2012 Report Posted April 29, 2012 BTW, it would be nice to have an ability to change the Lua window title. Even if it is only one window for all scripts, not all of them gonna use it at the same moment. And with title I could make it look more as part of the script, not just an abstract "Lua Display". Okay. I'll consider this, but with Lua it will be named by the most recent Lua program to name it -- the opposite of the FS window created by the 3380/32FA method where the first one sticks and no one later can change it. I'll probably add it as an optional parameter to the ipc.setdisplay function, making the position and size optional too. Maybe read the name with the ipc.getdisplay function too, so nice cooperative programs can save and restore it. I'll look at this when I get beck from holiday, 15th May or later. Too busy this week. Regards Pete
Artem Crum Posted April 29, 2012 Author Report Posted April 29, 2012 I'll probably add it as an optional parameter to the ipc.setdisplay function, making the position and size optional too. Maybe read the name with the ipc.getdisplay function too, so nice cooperative programs can save and restore it. That would be great, thanks. Another question on the same topic - is there a way to get current display's resolution? I. e. I want to place Lua Display window in a lower left corner.
Pete Dowson Posted April 29, 2012 Report Posted April 29, 2012 Another question on the same topic - is there a way to get current display's resolution? I. e. I want to place Lua Display window in a lower left corner. Not at present. The facility is really almost a directinterface to an FS function I found, and only offers the facilities it provides. I don't know if any of the other Lua facilities allow you to get such info -- i.e. the basic Lua libraries? Probably unlikely. Ideally i'd rather use a system like the one in the ext library, where all sizes and positions are in terms of percentages of the screen size, with a screen number too for multiple screens. Maybe I can do that for the Lua Display options, though I think I'd rather look for a way of implementing something more flexible, with multiple window possibilities perhaps. I didn't implement the wnd library in FSUIPC, only in Wideclient, because as it stands it would only be any use for folks using FS in Windowed mode. If I could find a way of having separately created FS child windows working in full screen mode then that library would be far better for your purposes. Unfortunately every way I tried to do such a thing either simply didn't work or created flashing windows. It's to do with DirectX which is presumably where I'd need to delve deeper. I know some add-ons manage good windows on top of FS in full screen mode, so it is possible. The ext library might be made to work with FS child windows if i made it search those as well as top level windows, which is all it does at present. Maybe that would be an easier way. I'll check when i get back later in May. Regards Pete
Artem Crum Posted April 29, 2012 Author Report Posted April 29, 2012 There is a program you may know - AivlaSoft EFB. I believe they do it through the SimConnect, but they've managed to create ATC-like window with their own content - which could be a great feature for the future versions of FSUIPC, allowing scripts and other addons like Radar Contact to communicate with user in more natural way. Any chances? Here is the screen: As for Lua Display window position, I can just save it's position on script exit, allowing user to chose it's place for himself... so, not a big deal right now. p. s. Multiple Lua displays will be cool too! And with control over fonts, colors and so on... (yeah, our wishes are endless!)
Pete Dowson Posted April 29, 2012 Report Posted April 29, 2012 There is a program you may know - AivlaSoft EFB. I believe they do it through the SimConnect, but they've managed to create ATC-like window with their own content - which could be a great feature for the future versions of FSUIPC, allowing scripts and other addons like Radar Contact to communicate with user in more natural way. Any chances? That's the Simconnect menu facility. It is fixed in that format, and can only be answered by pressing the numbers. It isn't any good for keeping data updated for folks to read -- it's a choice system, nothing else. I could offer a straight-through interface for that, but it seems so rigid compared to the needs of the programs I was supporting that it didn't seem worthwhile. Additionally it wouldn't be backwards-compatible for FS9 and before without a lot of work. Is that all you want to use the Window for, an immediate choice and that's it? I did implement the "ask" function for that. Pete
Artem Crum Posted April 29, 2012 Author Report Posted April 29, 2012 No-no, if it allows only fixed choices and nothing more, then it probably doesn't worth it. And I'm actually not ready to describe what I need exactly. I know about the "ask" function, and will check what it can do for my purposes. Right now I'm working on scripted failures engine and don't want to mess with dedicated GUI for it, so I need some space to display current systems status (will try to use Lua display for that purpose) and some instruments for user interaction to set things up (like setting max speeds for different flaps positions for current aircraft, switching some failure modules on/off and so on). This could be done with XML-gauge, but it will require to edit panel.cfg for each aircraft and I don't like that, so I'm looking for an easier and yet universal solution.
Pete Dowson Posted May 16, 2012 Report Posted May 16, 2012 I need some space to display current systems status (will try to use Lua display for that purpose) Facilities for individually owned and titled Windows for the ipc.display and ipc.linedisplay functions are now included in the latest updates for FSUIPC3 and FSUIPC4. The details are in the updated Lua plug-ins package -- please see the Subforums. The new entry is lua.setowndisplay, and it sets the title, position and size for a Window which is specific to the Lua plugin. The function can be used to retitle and resize/position the Window at any time too. Regards Pete
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now