Jump to content
The simFlight Network Forums

Recommended Posts

Posted

hi,

I'm creating application that does show GSX menu and relevant buttons to input menu selections to GSX via browser in my iPad. For that i'm running wideclient and saving the menus to text file my application reads and converts to webpage.

usually it works great but i've found out one bug that happens everytime. Seeing from the ipc.log in lua script i can see that wideclient is not even loggin the menu when this happens so seems it's not a bug in my app reading the text file but something inside GSX, simulator, wideserver or wideclient or just my ini settings.

really easy to reproduce if you have gsx:

1) open gsx menu and request pushback and make selections needed

2) abort pushback

3) open gsx menu again and request pushback. the next screen asking for pushback directions is not logged?

attached lua script i'm using. Could you check and test if it's only me and if possible give some hints how to make it to work

FYI, i haven't tested if this works better when running wideclient on 2nd machine but will do that after weekend. Currently running on same machine where sim running with instance=1 ini setting. i can also provide logs if needed after weekend when i'm back in the sim

function textandmenu(mtype, colour, scroll, delay, id, n, msgs)
	if n > 0 then
		ipc.log("text and menu function type ".. mtype .. " messages ".. n)
		if mtype == 2 then
			-- Menu
			file = io.open("gsxmenu.txt", "w+")
			io.output(file)
			--first row of messages is not needed as 2nd one is the subject of menu and 1st is just gsx general subject
			--io.write(msgs[1])
			--io.write("\n")
			io.write(msgs[2])
			io.write("\n")
			i = 3
			j = 1
			while i <= n do
				io.write(j .. " - " .. msgs[i])
				io.write("\n")
				i = i + 1
				j = j + 1
				if (j > 9) then 
					j = 0
				end
			end
			io.close(file)
		else
		-- Text
			file = io.open("gsxtext.txt", "w+")
			io.output(file)
			io.write(msgs[1])
			io.write("\n")
			io.close(file)
		end
	end
end

event.textmenu(0, "textandmenu")

 

Posted
On 9/16/2016 at 8:47 AM, jounipyh said:

really easy to reproduce if you have gsx:

1) open gsx menu and request pushback and make selections needed

2) abort pushback

3) open gsx menu again and request pushback. the next screen asking for pushback directions is not logged?

Is this the only circumstance? Do the GSX menus continue after this sequence?

Which Flight Sim are you using?

I will try to reproduce it, but it might not be for a day or two whilst I'm catching up. I use GSX and ProATC/X extensively on my cockpit setup and so far have never had a problem with the menus appearing. But currently I am using FSX-SE. I plan to install P3D 3.4 on my cockpit Pc later this week and will test then.

Pete

 

Posted
1 hour ago, Pete Dowson said:

Is this the only circumstance? Do the GSX menus continue after this sequence?

Which Flight Sim are you using?

 

hi,

The issue was seen on p3D v3.3. I have installed v3.4 now but have not tested it yet. Will do this evening.

System continues to work after I send F12 2 times to close and open menu again. Then all is clear. Until next pushback abort. This only happens when push back is aborted. Also I need to double check but this might happen also on first pushback selection but i'm not sure now as I'm not near the simulator but at work

Br, Jouni

Posted

hi,

Seems to be behaving the same way in P 3.4. if pushback is aborted. then menus work in LUA only after closed and opened again.

FSUIPC: 4.956, P3D: 3.4.9.18400 

Br, Jouni

Posted
4 hours ago, jounipyh said:

hi,

Seems to be behaving the same way in P 3.4. if pushback is aborted. then menus work in LUA only after closed and opened again.

FSUIPC: 4.956, P3D: 3.4.9.18400 

Br, Jouni

Okay. I should be able to check this here tomorrow (Wednesday).

Pete

 

Posted

I've just run thorough tests on this with FSX-SE, which is my normal sim. It works fine every time there.

But then I ran P3D version 3.3.5 (not installed 3.4 there yet), and it looks like something has changed in this area of P3D, as it used to work fine.

In my case it is worse that your experience. The GSX menu comes up in WideClient initially, but only lasts 2 seconds or less then removes back to being displayed on the P3D screen!

I'm investigating, but if I cannot find a solution relatively quickly it will have to wait till maybe next week, as I must get a revised install package out very soon for P3D 3.4. Apart from myself, you are the only other person I've heard of using the text menu diversion option!

Meanwhile, it would help me identify why my experience is different to yours to get some extra FSUIPC logging. Please add these lines to your FSUIPC4.INI [General] section:

Debug=Please
LogExtras=32

then reproduce the problem, in an exact sequence which you can write down, then show me the log, or ZIP it and send it to petedowson@btconnect.com.

Thanks

Pete


 

Posted
20 minutes ago, Pete Dowson said:

In my case it is worse that your experience. The GSX menu comes up in WideClient initially, but only lasts 2 seconds or less then removes back to being displayed on the P3D screen!

Well actually it behaves the same way here.

I thought it was GSX behaving oddly so that's why i added n>1 to first check in LUA script so that it only writes menus if there are at least one row :) And in my own application that reads menu.txt it's showing it only if txtfile is recent than previous menu shown and menu is hidden when any button in my own app is pressed and send to GSX

20 minutes ago, Pete Dowson said:

Ipart from myself, you are the only other person I've heard of using the text menu diversion option!

Yeah, it was the only solution i could find to be able to get gsx text to my application https://github.com/jounip/iFlyWebUi (ugly code as it's 2nd program ever I'm writing)

22 minutes ago, Pete Dowson said:

it would help me identify why my experience is different to yours to get some extra FSUIPC logging.

Will do tomorrow as I'm offsite today. Might not give you new info though as said, behaviour is similar to yours. 

 

Br,

Jouni

Posted

Some possibly good news. I think it's due to a Window name change between P3Dv2 and P3Dv3. FSUIPC tracks the Window to see when it is closed. If it doesn't find it it assumes it is closed and sends the "clear" to Wideclient.

The names were the same in FSX and P3Dv1, but changed in P3Dv2. I think they've changed again in P3Dv3!

I'm just about to do some tests. If it is okay here after putting the new names in I'll give you a link to a test version, 4.956a. But I may have to go ahead tomorrow with 4.957 in any case.

 

Posted
8 hours ago, Pete Dowson said:

about to do some tests. If it is okay here after putting the new names in I'll give you a link to a test version, 4.956a. But I may have to go ahead tomorrow with 4.957 in any case.

No rush. This can wait until the installer is done. By the way, log is sent if there is any good info for you regarding the pushback direction menu missing.

Br, Jouni

Posted
Hi Jouni,
 
It is the same here, though here it doesn't miss the menu at all. But I think that is just a matter of timing.
 
I fixed it so it will work – the Window name had been changed, which is the reason. However, also due to the way the P3D screen is now drawn, more like FSX’s, is isn’t possible for me to hide the in-sim window. The best I can do is as with FSX – make it a bit smaller and more it top left (which luckily is out of easy site from my cockpit window).
 
The fix will be in 4.957 which I hope to release later tomorrow, or at the latest on Friday.
 
Pete
 
 
  • 1 month later...
Posted (edited)

Guys, could you please help me with the text for GSX/PRO/ATCX lua, that I would just drop in my WideClient folder and enjoy handling of these programs from/on my Client PC.

It's far beyond my depth to even edit TextMenu.lua properly so that it would show GSX and PRO/ATCX instead of Radar Contact.

Much thanks,

Igor. 

 

Edited by Sabrefly
Posted (edited)

Ok, I'm on P3D v3.3, FSUIPC v4.958, WideClient v6.999z2. I have latest GSX in P3D. AS2016 and PATCX installed on different Clients.

My first test is to conjure up GSX menu window and messages on one of my Clients. I first set NewInterceptTextMenu=Full in FSUIPC4.ini. I have the following textmenu.lua in WideClient folder:

colours = { 0x000, 0xfff, 0xf00, 0x0f0, 0x00f, 0xff0, 0xf0f, 0x0ff }
doshow = 1
shown = 2
textset = false
menuset = false
time2 = 0
time3 = 0
timeclear2 = 0
timeclear3 = 0

w1 = wnd.open("Radar Contact", WND_FIXED, 1280,0,1024,768)
wnd.backcol(w1, 0x000)
wnd.textcol(w1, 0x0f0)
wnd.font(w1, WND_ARIAL, 24, WND_BOLD)

w2 = wnd.open("FSX Text", WND_FIXED, 1280,0,1024,100)
wnd.backcol(w2, 0xfff)
wnd.textcol(w2, 0x000)
wnd.font(w2, WND_ARIAL, 17, WND_BOLD)

w3 = wnd.open("FSX Menu", WND_FIXED, 1280,100,1024,668)
wnd.backcol(w3, 0x88f)
wnd.textcol(w3, 0x000)
wnd.font(w3, WND_ARIAL, 17, WND_BOLD)

ext.state("FSX Menu", EXT_HIDE)
ext.state("FSX Text", EXT_HIDE)
ext.state("Radar Contact", EXT_NRML)
w1text = ipc.readSTR(0x3380,128)
ipc.log(w1text)
wnd.text(w1, w1text)

local function testifclear()
  doshow = 1
    if menuset or textset then
       doshow = 2
    end
    if doshow ~= shown then
       if doshow == 1 then
               ext.state("FSX Text", EXT_HIDE)
                ext.state("FSX Menu", EXT_HIDE)
                ext.state("Radar Contact", EXT_NRML)
                wnd.clear(w1)
                wnd.text(w1, w1text)
            ipc.log("Showing RC")
         else
                ext.state("Radar Contact", EXT_HIDE)
                 ext.state("FSX Text", EXT_NRML)
                ext.state("FSX Menu", EXT_NRML)
            ipc.log("Showing FSX Menus")
             end
     shown = doshow
    end
end

local function clearw2()
   wnd.clear(w2)
     textset = false
   testifclear()
end   

function clearw3()
   wnd.clear(w3)
     menuset = false
   testifclear()
end   

function textandmenu(mtype, colour, scroll, delay, id, n, msgs)
    doshow = 1
    if mtype == 2 then
       -- Menu
      time3 = 0
      if n == 0 then 
         wnd.clear(w3)
         menuset = false
             testifclear()
      else
         menuset = true
             testifclear()
         wnd.clear(w3)
           wnd.text(w3, " " .. msgs[1])
           wnd.text(w3, " ")
           wnd.text(w3, " " .. msgs[2])
           wnd.text(w3, " ")
           i = 3
           j = 1
           while i <= n do
                 wnd.text(w3, " " .. j .. " - " .. msgs[i])
              i = i + 1
              j = j + 1
              if (j > 9) then 
                 j = 0
              end
           end
           if delay ~= 0 then
                   timeclear3 = delay * 1000
                   time3 = ipc.elapsedtime()
           end
      end
    else
      -- Text
      time2 = 0
        if n == 0 then 
         wnd.clear(w2)
         textset = false
             testifclear()
      else
         textset = true
             testifclear()
           wnd.textcol(w2, colours[colour+1])
              wnd.backcol(w2, logic.Xor(colours[colour+1], 0xfff))
           wnd.text(w2, msgs[1])
           if delay then
                   timeclear2 = delay * 1000
                   time2 = ipc.elapsedtime()
           end
      end
    end
end

ctr = 0
function time()
    ctr = ctr + 1
        val = ipc.elapsedtime()
    if time2 ~= 0 and ((val - time2) > timeclear2) then
       clearw2()
       time2 = 0
    end
    if time3 ~= 0 and ((val - time3) > timeclear3) then
       clearw3()
       time3 = 0
    end
    if (ctr <= 2) then 
        ipc.togglebitsUW(0x32FA,0xffff)
    elseif (ctr > 10) then ctr = 0 end
end    

function update1(off, val)
     w1text = ipc.readSTR(0x3380,128)
     wnd.clear(w1)
     wnd.text(w1, w1text)
end

event.textmenu(0, "textandmenu")
event.offset(0x3380, "STR", "update1")
event.offset(0x32FA, "UW", "update1")
event.timer(500, "time")

testifclear()

from this post: 

After WideClient gets connected I open GSX menu. Due to the above code GSX menu opens truncated in the top left corner of my P3D screen. And this is it. No window comes up on the Client, and this must be my problem.

Please help me with it. Ultimately I'd like to control GSX and PRO-ATC/X menus  from my Client and to see their respective messages on it. 

For what it matters on the same Client I run as well VAS FSUIPC.lua:

-- Create the display window for 2 values, position x=800, y=400
h = display.create("My next display", 2, 800, 400)


-- Update the display at 500 msec intervals (see event at end)
function mytimer(time)


    -- display 1 = frame rate
    fr = ipc.readUW(0x0274)
    if fr ~= 0 then fr = 32768/fr end
    fr = math.floor((fr * 10) + 0.5)/10
    display.show(h, 1, "Frame Rate " .. fr .. " fps")
   
    -- display 2 = memory left free
    mem = ipc.readUD(0x024C)
    memmb = math.floor((mem/1024) + 0.5)
    display.show(h, 2, "Memory free " .. mem .. " kb (" .. memmb .. " Mb)")
   
end


-- Adjust timing to taste: 500 = 1/2 second
event.timer(500, "mytimer")

And it works OK as designed. 

Thanks,

Igor.

 

 

Edited by Sabrefly
Posted

How many video screens do you have on your Client? Haven't you noticed that the Windows in your showtext.lua start at horizontal coordinate 1280? On my client that's on a separate screen to the right of the main Windows one.

The Lua plug-ins I provide are just examples. Examples are to be learned from, not copied and used without thought. The Window is created where you tell it be. If that is off screen, you won't see it!

The second Lua example you include above doesn't use the Window facility. Display operates differently.

You do really need to refer to the Lua documents provided, especially the description of the functions FSUIPC provides, which are all fully documented in the Lua Library document.

Pete

 

Posted (edited)
39 minutes ago, Pete Dowson said:

How many video screens do you have on your Client? Haven't you noticed that the Windows in your showtext.lua start at horizontal coordinate 1280? On my client that's on a separate screen to the right of the main Windows one.

I have only one video screen on my Client. I will try to use value 0 instead and see what happens. Hacking! 

Thanks,

Igor. 

PS: sorry, I know nothing about programming, it would be quite a huge undertaking for me. Mostly I can only buy tools and utilities to achieve what I need.

Edited by Sabrefly
Posted (edited)

Oh my! It's like a miracle, I see it now.

Honestly I've learnt nothing from the example but your tip was invaluable.

I'll try to fasten PROATC/X to your example lua.

Thank you so much,

Igor.

PS: Now I'll just need to decrease the fonts and learn how to get messages move to the next line in the window instead of getting cut off, then I'm ultimately happy.

Edited by Sabrefly
Posted

Pete, one last question here please: I'd like to leave PATC/X information line on P3D screen and have it mirrored on the Client. 

I have NewInterceptTextMenu=Yes, so menus stay normal on P3D. But PATC/X info line is gone, I can see it only broadcast on the client. What do I need to edit in this lua? (above).

Many thanks!

Igor.

 

Posted
3 hours ago, Sabrefly said:

Pete, one last question here please: I'd like to leave PATC/X information line on P3D screen and have it mirrored on the Client. 

I have NewInterceptTextMenu=Yes, so menus stay normal on P3D. But PATC/X info line is gone, I can see it only broadcast on the client. What do I need to edit in this lua? (above).

Sorry, there's no way to do that at present. I really wanted to divert both completely -- not have anything left at all on the Server, but I found that if I did that with the Menu then SimConnect didn't return the selections to the program whose menu it is. But if I could have found a way, I would have and will still do

If it's a desperate need you have to leave the original displays alone AND have copies on the Client, I'll see what I can do. But may I ask why? The whole point for me was trying to avoid the loss of realism having a menu pop up on the scenery in front of you, and the same goes for the line at the top of the screen. What is your motivation?

Pete

 

Posted
11 hours ago, Pete Dowson said:

What is your motivation?

Pete

Nothing worth your time, Pete! 

Generally I like to manage GSX/PATCX menus and see their info lines on the main P3D screen. These are my flight gear and monitors during my normal flight: 

20161113_150816.jpg

20161113_150804.jpg

20161113_145039.jpg

20161113_145032.jpg

Posted

But also when flying, particularly on longer BAV flights, I switch my main monitor and play NHL17, like below in the picture. Usually I have enough time for a couple of games, sometimes even online. Thats's when it's so helpful to have the info line on the right Monitor, because it may get very noisy in the game and the info window makes sure I won't miss any instruction from PATCX.   :)

However I'm having only one problem left with your lua now. I can't get long messages from PATC/X moved to the next line instead of getting cut off in the window. I played with some wnd.* parameters but in vain. Is it possible to have long lines word-wrap properly below and not going beyond the window (to the right)?

Many thanks,

Igor. 

 

 

20161113_145303.jpg

Posted
1 hour ago, Sabrefly said:

I can't get long messages from PATC/X moved to the next line instead of getting cut off in the window. I played with some wnd.* parameters but in vain. Is it possible to have long lines word-wrap properly below and not going beyond the window (to the right)?

There are two things you could try. First is to make the font in that window smaller. That's set by the line

wnd.font(w2, WND_ARIAL, 17, WND_BOLD)

17 is the font size. Try making it smaller. You could also try normal text instead of bold:

wnd.font(w2, WND_ARIAL, 17)

The other is to split the text yourself. The text is displayed by this line

wnd.text(w2, msgs[1])

You'd need to use some string functions to find a suitable place in the string in "msgs[1]" to insert a new line character (\n or \r). I haven't really got time to do this for you at the moment. The Lua string library is part of the main lua language and is fully documented on the lua website.

Try a smaller font first.

Pete

 

Posted
1 hour ago, Pete Dowson said:

Try a smaller font first.

Pete

 

Of course I did that already, and it worked!  No worries.

I just wanted to have the luxury of a conveniently sized text visible in full on the additional monitor.  I wish there was some program like ShowText for my purpose. 

When somebody knowledgeable has a moment please help me with this.

Many thanks,

Igor.

PS: I'll try to edit as follows:

wnd.text (w2, n, msgs[1])

and see what happens. Just pls don't rail or laugh at me  :)

PSS: It didn't work, of course ))

Posted

For now just break the string in msgs[1] if it is longer than x characters (your choice of x). something like this (replacing that one line wnd.text(w2 ...)

x = 80  --my example of how many characters you want, max
mycopy = msgs[1] --make a copy for me to use
len = string.len(mycopy)
if len > x then
   --need to split
   mycopy = string.sub(mycopy,1,x) .. '\r' .. string.sub(mycopy, x+1)
end
wnd.text(w2, n, mycopy)

Now I don't guarantee the above -- I've not tested it here, and I make mistakes just like any other programmer. Always check the Log file (in the same folder) to see if any errors occurred.

The above MIGHT work better as two separate lines (ie two separate wnd.text lines). But try the above first.

Pete

P.S. Please don't expect much more from me in the way of direct programming. The whole idea of Lua being added to FSUIPC was to add to all the things that users could do for themselves, rather than me having to program them. Lua is easy enough to learn. I recommend getting a starter guide to Lua programming. "Beginning Lua Programming" is a good book, widely available.

Pete

 

 

Posted

 

8 hours ago, Pete Dowson said:

Please don't expect much more from me in the way of direct programming. The whole idea of Lua being added to FSUIPC was to add to all the things that users could do for themselves, rather than me having to program them.

I know this is one of those: "...they pull me back in" moments, Pete, really sorry and thanks for your time!  

If I replace:

 wnd.text(w2, msgs[1])

by this:

x = 80  --my example of how many characters you want, max
mycopy = msgs[1] --make a copy for me to use
len = string.len(mycopy)
if len > x then
   --need to split
   mycopy = string.sub(mycopy,1,x) .. '\r' .. string.sub(mycopy, x+1)
end
wnd.text(w2, n, mycopy)

the windows come up ok but no messages are displayed neither from GSX nor from PATC/X (menus are OK) 

Thanks,

Igor.

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.