Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Help, mr. Peter !

What did I do wrong, here (so that I can't manage to change the ATC flight number via this Lua Code, as denoted by the fact that flt1 <> fltn):

ipc.set(fltn, ipc.ask ("Enter flt.no. for simming"))

ipc.writeSTR(0x3130, fltn)

flt1 = ipc.readSTR(0x3130, "6")

ipc.display(flt1, 3)

Thanks a lot for the hint ...

Eugenio, Italy.

Posted

What did I do wrong, here (so that I can't manage to change the ATC flight number via this Lua Code, as denoted by the fact that flt1 <> fltn):

Can you change the flight number by writing to that offset? I don't know.

If you are talking about FSX (you don't actually give any context), then what you write and what you read may be different if simConnect either doesn't use what is written, or takes a little while to do so. Use the FSUIPC Monitoring facilities (on the Logging tab) to check.

in this line

ipc.set(fltn, ipc.ask ("Enter flt.no. for simming"))

the name of the variable you want to set as a Global needs to be a string, i.e. "fltn", as defined in the documentation. Here, the global variable you create will be named by the string value of "fltn", which is probably 'nil' or something like that.

Why not just do

fltn = ipc.ask ("Enter flt.no. for simming")

Regards

Pete

Posted

Ooops, I'm sorry, mr. Dowson, I always forget to tell people I'm still in love with good ole FS9 ...

I found the 0x3130 offset - among the others - in your "FSUIPC for programmers" manual.

I checked it via FSInterrogate and noticed that only 6 bytes (0x3130 through 0x3135) are dedicated to storing the ATC flight number, that is a string of maximum 5 chars ending with a zero.

I managed to read it through the ipc.readSTR command, so I thought it was possible to act on it through the ipc.writeSTR command as well ... but after I issue that command, with no apparent syntax errors (the log looks okay), the contents of those bytes are still unchanged !!!

Why does it happen ?

Thanks again for the attention,

Eu

p.s. the other command syntax you suggested was - actually - the very first I tried. No way. Then I re-read the library list and switched to something which looked more refined and, possibly, more effective ... no way !

Posted

I found the 0x3130 offset - among the others - in your "FSUIPC for programmers" manual.

I checked it via FSInterrogate and noticed that only 6 bytes (0x3130 through 0x3135) are dedicated to storing the ATC flight number, that is a string of maximum 5 chars ending with a zero.

Did you try using an aircraft defined with a longer flight number? FSUIPC just reads a string value and, as the documentation tells you, allows up to 12 character including the zero. I've no way of proving whetherr that's enough or too much. How did you prove it?

I managed to read it through the ipc.readSTR command, so I thought it was possible to act on it through the ipc.writeSTR command as well ... but after I issue that command, with no apparent syntax errors (the log looks okay), the contents of those bytes are still unchanged !!!

Why does it happen ?

Because FSUIPC3 offsets 3130 - 3177 inclusive are all read-only. The flight number is read from a token variable and there's no way to write those.

The SimConnect SDK does indicate that the same value is writeable on FSX, but even there I don't know if it actually works. I've never tried it.

Regards

Pete

Posted

How did I prove it ?

Well, I took the other way round ... I saw that - through FS9's menu - one isn't allowed to input a flight number longer than 5 chars (which become six after the final zero that terminates the string), as well as I found that eight chars is the max allowed string lenght for the A/C registration tail number and it's accommodated a few bytes far from the ATC flight number.

A read-only offset ?

Too bad !!!

I thought it was a harmless one ...

To any other home cockpit builder who eventually reads this topic: if you ever find a quicker way to set ATC flight number (instead of accessing FS' menu), can you please tell it here ?

Thanks mr. Dowson, always three greens to everybody ...

Posted

I thought it was a harmless one ...

Harmless in what way?

If I knew how to change the ATC Flight Number in use, I would do. But that offset is just set be reading a token variable, as I said.

Regards

Pete

Posted

Harmless in what way?

If I knew how to change the ATC Flight Number in use, I would do. But that offset is just set be reading a token variable, as I said.

Regards

Pete

Harmless = not dangerous to be changed the way I wished

Okay, understood, your statement is clear and final ...

Alas !

;-)

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.