Jump to content
The simFlight Network Forums

Recommended Posts

Posted

:?:

Hello (Pete),

long time I didnt realize it, now i know it. Until now i used the offsets for the "Glogal Weather" to change the weather with my addon. Now i learned about the sectors and NWI in FS9.

First off all, i want to send the "Clear all Weather" command to FS. I defined the 1024 Byte variable NewWeather as described and set the uCommand to NW_CLEAR.

But now my problem, how can i transmit that command (syntax) via the regular FSUIPC commands (or are there other ones)

? FSUIPC_write(&HC800, 1024, VarPtr(NewWeather), dwResult) (VB)

Is it possible to transmit a 1024 Byte variable?

If I do it this way the program crashes.

I hope it is no secret and it helps if I can only do the ClearAllWeather.

THX and best regards

Roland

Posted

I defined the 1024 Byte variable NewWeather as described and set the uCommand to NW_CLEAR.

But now my problem, how can i transmit that command (syntax) via the regular FSUIPC commands (or are there other ones)

? FSUIPC_write(&HC800, 1024, VarPtr(NewWeather), dwResult) (VB)

Is it possible to transmit a 1024 Byte variable?

If I do it this way the program crashes.

Sorry, you need help from a VB programmer. I have no idea what may be wrong with your code. Oh, except for one possibility:

&HC800

I think VB does a very nasty thing with that. It changes it to &HFFFFC800. Don't ask me why -- because it's a daft language, I'd say. It seems all VB programmers need to know these daft antics.

Worse, it even does it to &H0000C800 !!! Would you believe it?

I seem to remember someone telling me that to stop VB doing such silly things you have to add an & at the end, so:

&HC800&

but I wouldn't swear to it. Best to look it up in some VB reference book.

In the languages I know you can define structures, Those 1024 bytes are not just an array of bytes, they are a mixture of integers, strings, shorts, and so on. However, for the purposes of Reading and Writing to FSUIPC, yes, you treat them just as a bunch of bytes. And 1024 of them can be written in one block -- your problem in in the VB code, which I'm afraid I know nothing about.

Maybe I am wrong and someone will see this and help. There are a few very good VB programmers who visit here. But meanwhile you should realise that you do not have to write all 1024 bytes. In fact that is very inefficient. Just write what you need to write.

To clear the weather you only need to write the command (short at C800), and a signature (unsigned int at C804). You can write them separately or together, but if they are two writes make sure the writing of the signature is last as it is that which triggers the action.

[CORRECTION]: make sure the writing of the COMMAND is last as it is that which triggers the action. Sorry. It is the signature when reading weather, not when writing it.

Similarly for all the other weather stuff. Only write the weather you need, you don't need to send all 1024 bytes.

Regards,

Pete

Posted

Hi and BTW,

you don't need to write 1024 bytes to send the clear command. Just send the 'unsigned short' to 0xC800 and that's it!

MyWord := NW_CLEAR;

FSUIPC_Write($0800, 2, @MyWord, your_dw_result);

FSUIPC_Process(your_dw_result);

Best regards,

CATIII

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.