Jump to content
The simFlight Network Forums

Show message in fs2004


Recommended Posts

I want to show a message on the simulator (fs2004) and I use the following code in C ++ but does not work for me somebody I could help.

char mensaje[]="Test Message";

if (FSUIPC_Write(0x6D60, 1, mensaje, &dwResulttimer))

FSUIPC_Process(&dwResulttimer);

Where are you getting your mis-information from? Two things wrong there:

First, 6D60 is not the offset to write to for a message. It is only where the multi-line window title is set (exactly as it says in the documentation!). You don't need one of those for a normal single line message, or even for a multi-line message is the default "FSUIPC Window" (or whatever) will do -- and in any case, only the first program to write to 6D60 gets its title there as the Window is only created once no matter how many times it is used.

Check offsets 3380 and 32FA, which are the ones handling messages. Please do refer to the documentation supplied in the SDK before writing to random variables!

Second, even if 6D60 was the correct offset, writing only 1 byte wouldn't get you very far! Why do you use a length of 1 for a message which is obviously longer than 1 character?

Pete

Link to comment
Share on other sites

Hi Pete!

With the following code the message is display in the sim but this no clear in n seconds with the parameter "+n display for n seconds, or until replace"

The code:

//Mostrar mensaje en el sim

char mensaje[]="Mensaje Sim \0";

if (FSUIPC_Write(0x3380, 128, mensaje, &dwResulttimer))

FSUIPC_Process(&dwResulttimer);

if (FSUIPC_Write(0x32FA, 2, "+1", &dwResulttimer))

FSUIPC_Process(&dwResulttimer);

without +1

if (FSUIPC_Write(0x32FA, 2, "1", &dwResulttimer))

FSUIPC_Process(&dwResulttimer);

Clear message approximately in 50 seconds

Thanks for your help.

Link to comment
Share on other sites

With the following code the message is display in the sim but this no clear in n seconds with the parameter "+n display for n seconds, or until replace"

Sorry, you need to learn a little more programming I think:

char mensaje[]="Mensaje Sim \0";

if (FSUIPC_Write(0x3380, 128, mensaje, &dwResulttimer))

FSUIPC_Process(&dwResulttimer);

Here you are writing 128 characters, starting at mensaje[0]. Yet that variable is nowhere near that big! You could easily crash your program doing things like that! Use sizeof(mensaje) to get the proper size instead!

Also, in C/C++ declared strings automatically have a zero terminator appended. You do not need to add that \0 character!

Here:

if (FSUIPC_Write(0x32FA, 2, "+1", &dwResulttimer))

You are providing the address of the string variable "+1" as the address of the 16-bit binary value to be written. The string "+1" will be some very large binary number! Strings are only used in FSUIPC where it says so!

If you don't understand C then maybe you should look at some more elementary language which doesn't need so much work on your part? There are examples in the SDK for several languages. Maybe C is not suitable for you?

without +1

if (FSUIPC_Write(0x32FA, 2, "1", &dwResulttimer))

FSUIPC_Process(&dwResulttimer);

Clear message approximately in 50 seconds

It will actually be 49 seconds, because the string "1" is represented in 16 bits as 0x0031 (0x31 is the character 1, and the the 0 comes from the zero string terminator. 0x31 is 49 in decimal.

You don't need to call FSUIPC_Process for everything you write. That is very very inefficient. Do all the reads and writes and one "Process" call at the end.

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.