Jump to content
The simFlight Network Forums

Reading FS Message


Recommended Posts

Hi Pete,

 

I'm writing a program to read the FS messages and do after specific actions.

 

For that i read every second the offset 3380 (in the same way I use to read the Aircraft model to read a variable string zero terminating), but even if a message is diplayed on the FS screen I'm not able to intercept it (attached the VB routine I'm using).

 

What am I probably missing here?

 

Thanks for the support and best regards

 

Joe

 

 

 

 

read message.txt

Link to comment
Share on other sites

I'm writing a program to read the FS messages and do after specific actions.

 

Reading messages? From what programs?

 

For that i read every second the offset 3380 (in the same way I use to read the Aircraft model to read a variable string zero terminating), but even if a message is diplayed on the FS screen I'm not able to intercept it (attached the VB routine I'm using).

 

 

Offset 3380, along with the control at 32FA, is for FSUIPC application which wish to display messages on the FS screen. It isn't capturing FS's own messages -- or at least, it certainly isn't doing so in FSX or P3D.

 

I don't know VB, but the code fragment you included in your post seems to be trying to read the control value at 32FA as 128 byte message when, in fact, 32FA is a 2-byte control value for the application writing the message. I think you need to refer more to the Offsets lists and descriptions!

 

Pete

Link to comment
Share on other sites

Hi Pete,

 

you re right.. the code was my second attempt using the 32FA not noticing its format. My original attempt was done using the offset 3380 (that should be 128 long).

 

The FSX messages are produced by GSX: for example when the aircraft boarding or fueling is complete this is noticed through a FSX message.

 

Thanks again and best regards

 

Joe

Link to comment
Share on other sites

The FSX messages are produced by GSX: for example when the aircraft boarding or fueling is complete this is noticed through a FSX message.

 

GSX sends its messages direct to SimConnect. It doesn't use FSUIPC.  Offset 3380 is only used by FSUIPC applications to display messages.

 

There is a facility in WideClient which will divert GSX messages for use or display on another PC. The facility is by a Lua plug-in to WideClient. The details are in the Lua library document, see the event.textmenu function. There's a parameter needed in FSUIPC4's INI file too -- it is all described there.

 

If necessary, you can run WideClient on the same PC as FS by setting its "ClassInstance" parameter to a non-zero value. (Of course you need a WideFS registration). 

 

Pete

Link to comment
Share on other sites

Hi Pete,

 

thanks for the support and of course I have a registered WideFS.

 

I cant try now, but do you think that could run adding to the ipcready.lua the following code on the PC where I have FSX?

 

function read_msg (mtype, colour, scroll, delay, id, n, msgs)

if msgs == "[GSX] Boarding Complete" then  

ipc.writeUB(66C0,1)

end

end

 

event.textmenu(0, "read_msg")

 

My VB program running on the cllent PC will execute specific actions if the value red in the offset 66C0 will be 1, providing after to set it back to 0.

 

Thanks again and best regards

 

Joe

Link to comment
Share on other sites

I cant try now, but do you think that could run adding to the ipcready.lua the following code on the PC where I have FSX?

 

The "event.textmenu" function is only available in WideClient. you have to place the Lua plug-in into the same folder as WideClient -- it will automatically run any Lua programs it finds in its folder.

 

You can of course get FSUIPC to run WideClient automatically using a parameter in the INI file's ]Programs] section.

 

You will need to specify the PCs IP Address (or, better, name) and Protocol=TCP in the WideClient.INI file, because the automatic broadcast reception won't occur on the same PC.

 

function read_msg (mtype, colour, scroll, delay, id, n, msgs)

   if msgs == "[GSX] Boarding Complete" then  

      ipc.writeUB(66C0,1)

   end

end

 

event.textmenu(0, "read_msg")

 

The msgs parameter is a table with n entries. If you want to read the first line you need to refer to msgs[1] not msgs, but first check that n > 0.

 

Otherwise your idea sounds okay.

 

Pete

 

Link to comment
Share on other sites

Hi Pete,

 

I did a frst attempt with the LUA, but I'm getting an error during the execution.

 

This is the LUA code:

 

function readmsg (mtype, colour, scroll, delay, id, n, msgs)
   if  n ~= 0 then
 ipc.writeUB(0x66C0,1)
   end
end
event.textmenu(0, "readmsg")

 

and this is the log with the error:

 

********* LUA: "message" Log [from WideClient] *********
Date (dmy): 03/06/14, Time 14:21:36.855: Client name is GIUSEPPE-PC
     1670 LUA: beginning "C:\WideFS\message.lua"
     1670 *** LUA Error: C:\WideFS\message.lua:6: attempt to call field 'textmenu' (a nil value)
     1670 LUA: ended "C:\WideFS\message.lua"
********* LUA execution terminated: Log Closed *********

 

do you have any idea why this is happening?

 

Thanks in advance and best regards

 

Joe

Link to comment
Share on other sites

function readmsg (mtype, colour, scroll, delay, id, n, msgs)

   if  n ~= 0 then

 ipc.writeUB(0x66C0,1)

   end

end

event.textmenu(0, "readmsg")

 

You aren't checking the content of the message?

 

 

     1670 *** LUA Error: C:\WideFS\message.lua:6: attempt to call field 'textmenu' (a nil value)

 

do you have any idea why this is happening?

 

 

 

It looks like you are using an old version of WideClient, before this facility was added!

 

Pete

Link to comment
Share on other sites

Hi Pete,

 

yes.... I have just checked that I had an old version of Wideclient: replacing it with the last one (6.999m) now the LUA log does not show any error, but the offset is not updated.

 

I have done two tests: one with the already attached script only checking (if i understood correctly) that 'some' message is displayed, the other one with the below code (really checking the message):

 

function readmsg (mtype, colour, scroll, delay, id, n, msgs)
   if  n ~= 0 then
      if msgs[1] == "[GSX] Boarding requested" then
          ipc.writeUB(0x66C0,1)
      end
   end
end

event.textmenu(0, "readmsg")

 

In both cases the offset stays at 0

 

Best regards

 

Joe

Link to comment
Share on other sites

Hi Pete,

 

it seems the problem is solved.

 

I red again the LUA documentation and checked the FSUIPC.INI. I have found there a row called 'NewInterceptTextMenu set to NO. After to have set the value to YES, the message is no more displayed, but the offset is written now.

 

Thanks once more time for your great support (as ever) and best regards

 

Joe

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • 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.