Jump to content

Correct syntax for offset 3340


Recommended Posts

Hello everyone,

I started experimenting with ambient wind at offset 3478 to simulate ground effect. It worked to some extent and when I started experimenting with "automatic" trim up during the flare the problems started.

As far as I can see, line 13 works fine and then the sim crashes at around 20 feet AGL (somewhere around lines 16-20). I think the problem is with my parameters/syntax for offset 3340. I also tried with offset byte setbits/clrbits, but it makes no difference.

This is the piece that's causing the trouble:

11=W0366=0 P0,1,Cx07003340,x000000FF ;joy 64 btns 1-8

12=W0366=0 P0,1,Cx07003344,x0000003F ;joy 65 btns 1-5

13=D31E4<700000 R64,0,Cx74003478,xFFFFFE3E

14=D31E4<680000 R64,1,Cx0B003340,x00000001

15=D31E4<500000 R64,2,C65615,0

16=D31E4<425000 R64,3,Cx0B003340,x00000004

17=D31E4<420000 R64,4,C65706,5000

18=D31E4<415000 R64,5,Cx0B003340,x00000010

19=D31E4<410000 R64,6,Cx74003478,x000001C2

20=D31E4<405000 R64,7,Cx0B003340,x00000040

21=D31E4<360000 R65,0,Cx74003478,x0000028A

22=D31E4<350000 R65,1,Cx0B003344,x00000001

23=D31E4<341000 R65,2,Cx74003478,x000002EE ;ground effect 2ft

24=D31E4<330000 R65,3,Cx0B003344,x00000004

25=D31E4<310000 R65,4,Cx74003478,x000000AA

26=W0366=1 R65,5,C65706,6000

27=P0,0,Cx0B003340,x000000FF

28=P0,0,Cx0B003344,x0000003F

I've been reading the forums, the SDK, etc, etc for over a month, reworked/corrected the ini 1000 times, but now I'm completely lost... Please help, what am I doing wrong?

Link to comment
Share on other sites

I started experimenting with ambient wind at offset 3478 to simulate ground effect. It worked to some extent and when I started experimenting with "automatic" trim up during the flare the problems started.

I don't really understand you here. Can you explain please. What is "automatic trim" and how are you hoping to work it?

As far as I can see, line 13 works fine and then the sim crashes at around 20 feet AGL (somewhere around lines 16-20).

So you really mean the sim (i.e. FS itself) crashes, or just the aircraft? There's quite a difference!

I think the problem is with my parameters/syntax for offset 3340. I also tried with offset byte setbits/clrbits, but it makes no difference.

The byte at 3340 is just the first of 36 offering 288 "virtual buttons". To set a button 'on' or 'pressed' you'd use Offset Byte Setbits, with a parameter with only the approrpiate bit set (1, 2, 4, 8, 16, 32, 64, or 128 in 3340 for buttons 0-7). To set a button "off" or "released" you'd similarly use Offset Byte Clrbits, with a parameter with only the approrpiate bit set (1, 2, 4, 8, 16, 32, 64, or 128 in 3340 for buttons 0-7).

Or of course x01, x02, x04, x08, x10, x20, x40, x80 if you use hex.

If it "makes no difference" to what you are doing whether the buttons are pressed or released, then there's really no point in using them, is there? ;-)

11=W0366=0 P0,1,Cx07003340,x000000FF ;joy 64 btns 1-8

12=W0366=0 P0,1,Cx07003344,x0000003F ;joy 65 btns 1-5

They are actually buttons 0-7 and 0-5 respectively (you have 6 bits in the second line's parameter), and you are using Offset Dword Setbits, not Byte, though if you don't care about the other 50 buttons being changed too then I suppose it doesn't matter.

Why are you setting all 14 buttons "pressed" or "on" when you press Joystick 0 button 1 and the aircraft is airborne?

If you only need 14 buttons, I'm not sure why you don't just use buttons 0-13 on the first joystick number, with Offset Word ClrBits/Setbits.

13=D31E4<700000 R64,0,Cx74003478,xFFFFFE3E

14=D31E4<680000 R64,1,Cx0B003340,x00000001

15=D31E4<500000 R64,2,C65615,0

16=D31E4<425000 R64,3,Cx0B003340,x00000004

17=D31E4<420000 R64,4,C65706,5000

18=D31E4<415000 R64,5,Cx0B003340,x00000010

19=D31E4<410000 R64,6,Cx74003478,x000001C2

20=D31E4<405000 R64,7,Cx0B003340,x00000040

21=D31E4<360000 R65,0,Cx74003478,x0000028A

22=D31E4<350000 R65,1,Cx0B003344,x00000001

23=D31E4<341000 R65,2,Cx74003478,x000002EE ;ground effect 2ft

24=D31E4<330000 R65,3,Cx0B003344,x00000004

25=D31E4<310000 R65,4,Cx74003478,x000000AA

26=W0366=1 R65,5,C65706,6000

27=P0,0,Cx0B003340,x000000FF

28=P0,0,Cx0B003344,x0000003F

First, just a little suggestion: it would be easier to see what was going on here if you used the radio altitude in metres at W31E6 instead of *65536 in D31E4. All multiplying by 65536 does is shift the integer part up 16 bits (65536 being 2 to the power of 16), so it resides in the 2nd 16-bit word (31E6). The 16 bits in 31E4 are the fractions of a metre (eg 32768 there would be 0.5 metres, being 32768/65536).

Second, it looks most intreresting and I expect I could spend a few pleasant hours working out exactly what you are doing (or trying to do), but I really have too much else on at present. Do you think you could present the same code, with line-by-line comments on what you think is accomplished by it? This would make it a doddle to check for you.

I've been reading the forums, the SDK, etc, etc for over a month, reworked/corrected the ini 1000 times, but now I'm completely lost...

I've not seen anything quite so, er, complex on this Forum, and I am lost too but mainly because I really don't know what you are trying to achieve nor how. If you'd like to annotate it, as I said, I will take a further look. Okay?

Regards

Pete

Link to comment
Share on other sites

Hi Pete,

Thanks for the quick reply. I'll try to explain my "code" line by line :-)

1. By "automatic trim" (sorry, poor choice of words) I mean this: a side effect of adding ambient wind is that the nose

of the aircraft goes down a bit while the wind is applied. Also, to keep the nose up in the flare you need to apply

constant pressure on the joystick. Maybe in RL it's the same I don't know... So by trimming the nose up, it's

easier to keep it there. It's difficult to explain but it works well.

2. Joystick 0, button 1 is my autopilot disconnect switch. I "switch on" the ground effect when I disconnect the

autopilot. I also wanted to create a different ground effect for takeoff (with reverse sign for the condition

i.e. D31E4>350000 more ambient wind, D31E4>400000 less ambient wind, etc).

So you really mean the sim (i.e. FS itself) crashes, or just the aircraft?

Yes FS itself crashes, i.e. CTD, with no windows messages

Or of course x01, x02, x04, x08, x10, x20, x40, x80 if you use hex

Do you mean that I could use decimal?. Hmm I find it easier if it's decimal.

it would be easier to see what was going on here if you used the radio altitude in metres at W31E6

Thanks for the tip, I'll give it a try.

Now for the code (I've reworked the "Offset Byte/Word ClrBits/Setbits" part, I hope it's OK now.):

12=W0366=0 P0,1,Cx06003344,x3FFF ;"switches on the ground effect" it works in the air only, otherwise FS crashes

13=D31E4<700000 R64,0,Cx74003478,xFFFFFE3E ;negative Y wind - the aircraft doesn't "baloon" when you pull up the nose - looks closer to reality

14=D31E4<680000 R64,1,Cx09003340,x01 ;switches off the above button

15=D31E4<500000 R64,2,C65615,0 ;this is the automatic trim i was talking about - it's starts trimming and is turned off at the next line

16=D31E4<425000 R64,3,Cx09003340,x04 ;switches off the above button

17=D31E4<420000 R64,4,C65706,5000 ;sets the trim - there's no way to tell "C65615" when to stop trimming and so I have to stop it at some point and then set it to a certain value

18=D31E4<415000 R64,5,Cx09003340,x10 ;switches off the above button

19=D31E4<410000 R64,6,Cx74003478,x000001C2 ;ground effect ~ 10ft

20=D31E4<405000 R64,7,Cx09003340,x40 ;switches off the above button

21=D31E4<360000 R64,8,Cx74003478,x0000028A ;ground effect ~ 5ft

22=D31E4<350000 R64,9,Cx09003345,x01 ;switches off the above button

23=D31E4<341000 R64,10,Cx74003478,x000002EE ;ground effect ~ 2ft

24=D31E4<330000 R64,11,Cx09003345,x04 ;switches off the above button

25=D31E4<310000 R64,12,Cx74003478,x000000AA ;removes most of the ground effect very close to the rwy - this way the a/c "steps" firmly on the runway on touch down. there's no way to explain this, but it works as I want it

26=W0366=1 R64,13,C65706,6000 ;add more trim on touchdown otherwise the nose slams on the runway as if all passengers are in the cockpit

27=P0,0,Cx0A003340,x3FFF ;when I press the brakes I switch off all virtual buttons

Second, it looks most intreresting and I expect I could spend a few pleasant hours working out

exactly what you are doing

Thank you :-D I'm happy I've created something interesting (if I can get it to work properly of course). I used to have some working versions, but as I added new lines it all stopped working. A few other conclusions I made:

I've watched several videos over and over again, to see what happens IRL and then I test it in the sim. I keep changing the data until I'm satisfied. The results are very good IMO. The "downside" is that this "ground effect" cannot be used for every a/c because radio altitude is measured from the datum point of the a/c which is different for every a/c (Did I miss an offset for that, i.e. something that calculates the altitude from the wheels to the ground?). Pitch is also important because the datum point is not always exactly above the wheels.

I hope this is more understandable now. Explaining isn't my best skill :-)

Regards, Chris

Link to comment
Share on other sites

I mean this: a side effect of adding ambient wind is that the nose

of the aircraft goes down a bit while the wind is applied. Also, to keep the nose up in the flare you need to apply

constant pressure on the joystick. Maybe in RL it's the same I don't know... So by trimming the nose up, it's

easier to keep it there.

Yes, but isn't this the pilot's job? If you are on autopilot shouldn't the A/P cope?

Yes FS itself crashes, i.e. CTD, with no windows messages

Ah .... there's something seriously wrong then. You shouldn't be able to make FS crash.

Do you mean that I could use decimal?. Hmm I find it easier if it's decimal.

It understands decimal -- it will output in hex for those controls if you are using the Buttons dialogue in FSUIPC options, and generally for bit masks hex is more obvious.

12=W0366=0 P0,1,Cx06003344,x3FFF ;"switches on the ground effect" it works in the air only, otherwise FS crashes

Sorry, let me get this clear. Are you saying that applying a Y component ambient wind change whilst the aircraft is on the ground causes an FS hang? All the time? This should not be soI'd need to reproduce this.

This line, line 12, doesn't touch the wind of course. Incidentally, you seem to be switching on 14 buttons in Joystick 65, not 64, yet all your tests in later lines are on 64 (in 3340).

13=D31E4<700000 R64,0,Cx74003478,xFFFFFE3E ;negative Y wind - the aircraft doesn't "baloon" when you pull up the nose - looks closer to reality

You realise you aren't setting joystick 64 buttons now? Is it the action of setting a negative value to 3478 which crashes FS?

14=D31E4<680000 R64,1,Cx09003340,x01 ;switches off the above button
19=D31E4<410000 R64,6,Cx74003478,x000001C2 ;ground effect ~ 10ft

Or is this the line which crashes FS?

21=D31E4<360000 R64,8,Cx74003478,x0000028A ;ground effect ~ 5ft

Or thisor one of the others changing the Y ambient wind?

A process of elimination -- comment out each of the Y-affecting lines in turn -- might help.

25=D31E4<310000 R64,12,Cx74003478,x000000AA ;removes most of the ground effect very close to the rwy - this way the a/c "steps" firmly on the runway on touch down. there's no way to explain this, but it works as I want it

Won't this final Y-effect continue forever (well, for my 14 second or whatever timeout) after touchdown. You said doing this on the ground crashes FS, so isn't this the possible problem in the sequence?

I'd like to know why FS crashes when changing ambient winds on the ground. It cannot do with the X and Z cojmponents as I use those to deal with Taxi wind facilities. This is the part needing investigating.

The "downside" is that this "ground effect" cannot be used for every a/c because radio altitude is measured from the datum point of the a/c which is different for every a/c (Did I miss an offset for that, i.e. something that calculates the altitude from the wheels to the ground?).

No, I don't know anyway to get that information. Best to read the RA before takeoff! ;-)

Regards

Pete

Link to comment
Share on other sites

switches on the ground effect" it works in the air only, otherwise FS crashes

OkayI cannot make FS crash by setting any sort of values in 3478, and continuing to set them, even with my aircraft parked on the ground.

I really don't see anything else in your button programming which could crash FS -- the rest is all simply concerned with basic FS controls and virtual button manipulations. Something is evidently wrong somewhere, but I don't really know how to find out what, as you say it crashes to desktop with no error message.

Maybe I need the whole of your otherwise working solution to try here. You'll need to supply the Buttons section and tell me exactly what is supposed to do what and which aircraft, etc. I can do the whole thing in debug mode and trap the error as soon as it happens, wherever it happens.

Pete

Link to comment
Share on other sites

Okay as far as I see the problem is in offset 3340

Yesterday evening I started with the code which I posted here during the day. It started with a CTD. When I removed line 13 FS did NOT crash.

This is the code I used:

11=W0366=0 P0,1,Cx06003340,x3FFF

12=D31E4<700000 R64,0,Cx74003478,xFFFFFE3E

13=D31E4<695000 R64,1,Cx09003340,x01

14=D31E4<500000 R64,2,C65615,0

15=D31E4<425000 R64,3,Cx09003340,x04

16=D31E4<420000 R64,4,C65706,5000

17=D31E4<415000 R64,5,Cx09003340,x10

18=D31E4<410000 R64,6,Cx74003478,x000001C2

19=D31E4<405000 R64,7,Cx09003340,x40

20=D31E4<360000 R64,8,Cx74003478,x0000028A

21=D31E4<350000 R64,9,Cx09003341,x01

22=D31E4<341000 R64,10,Cx74003478,x000002EE

23=D31E4<330000 R64,11,Cx09003341,x04

24=D31E4<310000 R64,12,Cx74003478,x000000AA

25=W0366=1 R64,13,C65706,6000

26=P0,0,Cx0A003340,x3FFF

I then deleted everything from the buttons section except for this.

[buttons]

0=P0,1,Cx05003340,x03

1=D31E4<695000 R64,1,Cx09003340,x01

FS crashed again. I don't know what's going on, but I'm starting to get really frustrated.

I even thought for a brief moment that it's because the trouble is in line #13or because my last button is button #13 ...

No seriously, I tried everything. I changed the altitude (695000), I changed the button numbers, I changed the "Cx05003340" part to "Cx06003340" and "Cx07003340", then the "Cx09003340" part to "Cx0A003340" and "Cx0B003340" but it makes no difference. As soon as this line is reached it's a CTD :?

Regards, Chris

Link to comment
Share on other sites

Okay as far as I see the problem is in offset 3340

I then deleted everything from the buttons section except for this.

....

[buttons]

0=P0,1,Cx05003340,x03

1=D31E4<695000 R64,1,Cx09003340,x01

FS crashed again. I don't know what's going on, but I'm starting to get really frustrated.

Well, please be a little more patient. We'll get to the bottom of it. It is now sounding like an FSUIPC, not an FS problem, so I seriously do need to fix it myself.

First, please make sure you are using the very latest FSUIPC so I know we're doing the same thing. The latest is 3.742, available from the Other Downloads above.

Then add these lines to the [General] section of the stripped down Buttons section copy of the INI:

Debug=Please

LogExtras=2

LogButtonsKeys=Yes

Run FS, and operate whatever buttons you need to to make the crash. Please write down the sequence of button presses you need to do so I can repeat it here.

The problem with a CTD of course is that the Log file may not be complete -- the last buffer won't get flushed. But it'll be a start. The step after that would involve running a separate program (Debugview) to capture the logging as it occurs in real time, thus not losing any of the data.

ZIP up the Log, whatever you get, and send it to petedowson@btconnect.com.

And please do not expect miracles. I fix things as fast as I can you know.

Regards

Pete

Link to comment
Share on other sites

Another thought. In these lines:

13=D31E4<695000 R64,1,Cx09003340,x01

15=D31E4<425000 R64,3,Cx09003340,x04

17=D31E4<415000 R64,5,Cx09003340,x10

19=D31E4<405000 R64,7,Cx09003340,x40

21=D31E4<350000 R64,9,Cx09003341,x01

23=D31E4<330000 R64,11,Cx09003341,x04

you are causing FSUIPC to repeatedly clear alternate bits forever, even though they are cleared. Not only that, but because the trigger is itself a virtual button, the scan rate is probably very high -- I'm not sure what, I'd have to check.

This may be causing a problem, I don't know yet, I'd have to check. But even if this was not the problem, it is still very inefficient.

I don't understand why you are never turning off buttons 1, 3, 5, 7, 9, 11 -- or at least not till you've completely finished. Surely you can turn each off when it is turning off the associated action button, as it is not needed again?

i.e.

13=D31E4<695000 R64,1,Cx09003340,x03

15=D31E4<425000 R64,3,Cx09003340,x0c

17=D31E4<415000 R64,5,Cx09003340,x30

19=D31E4<405000 R64,7,Cx09003340,xc0

21=D31E4<350000 R64,9,Cx09003341,x03

23=D31E4<330000 R64,11,Cx09003341,x0c

This will get each of those lines only operating once, which is much tidier and probably safer.

Even if this fixes it I'd still like to get to the bottom of the CTD.

[LATER]

Yes! That was it! I managed to reproduce it using your never-ending virtual button clearances. The poblem was recursion -- the execution of the control to change a virtual button setting causes the check for virtual buttons -- yours are set to repeat, so they do and the control is re-executed, again, and so on, forever, in a tight loop. Eventually (pretty quickly actually) the stack overflows and, bang, FS CTDs!

I can and will fix it, it is easy to do, but your coding is still very inefficient nonetheless. The suggestion I make above works now, with the current versions of FSUIPC, so please just make those changes and you'll be fine.

I'll fix the recursion in any case in 3.743. It probably also affects the FSX version, but I'll do that in 4.10 when the FSX update is isued by Microsoft.

Thanks for pinpointing this for me! Please look out for 3.743 in the Other Downloads announcement, and use that when you can -- I'd like to make sure I've not messed anything else up by fixing this. ;-)

Regards

Pete

Link to comment
Share on other sites

Okay. 3.743 is available above now. But, after verifying that it does indeed fix your problem, I would still advise rationalising some of the settings.

In fact, as far as I can see, you can use half the number of virtual buttons you are using now. In other words, instead of:

11=W0366=0 P0,1,Cx06003340,x3FFF

12=D31E4<700000 R64,0,Cx74003478,xFFFFFE3E

13=D31E4<695000 R64,1,Cx09003340,x01

14=D31E4<500000 R64,2,C65615,0

15=D31E4<425000 R64,3,Cx09003340,x04

16=D31E4<420000 R64,4,C65706,5000

17=D31E4<415000 R64,5,Cx09003340,x10

18=D31E4<410000 R64,6,Cx74003478,x000001C2

19=D31E4<405000 R64,7,Cx09003340,x40

20=D31E4<360000 R64,8,Cx74003478,x0000028A

21=D31E4<350000 R64,9,Cx09003341,x01

22=D31E4<341000 R64,10,Cx74003478,x000002EE

23=D31E4<330000 R64,11,Cx09003341,x04

24=D31E4<310000 R64,12,Cx74003478,x000000AA

25=W0366=1 R64,13,C65706,6000

26=P0,0,Cx0A003340,x3FFF

use this:

11=W0366=0 P0,1,Cx05003340,x7F

12=D31E4<700000 R64,0,Cx74003478,xFFFFFE3E

13=D31E4<695000 R64,0,Cx09003340,x01

14=D31E4<500000 R64,1,C65615,0

15=D31E4<425000 R64,1,Cx09003340,x02

16=D31E4<420000 R64,2,C65706,5000

17=D31E4<415000 R64,2,Cx09003340,x04

18=D31E4<410000 R64,3,Cx74003478,x000001C2

19=D31E4<405000 R64,3,Cx09003340,x08

20=D31E4<360000 R64,4,Cx74003478,x0000028A

21=D31E4<350000 R64,4,Cx09003340,x10

22=D31E4<341000 R64,5,Cx74003478,x000002EE

23=D31E4<330000 R64,5,Cx09003341,x20

24=D31E4<310000 R64,6,Cx74003478,x000000AA

25=W0366=1 R64,6,Cx09003341,x40

26=W0366=1 R64,13,C65706,6000

27=P0,0,Cx09003340,x7F

Note I inserted 25 because I see you don't switch button 12 (my 6) off until you press your own 0,0. Is that right? Is there any reason why you shouldn't switch it off when 0366 gets set? Don't forget FSUIPC will keep applying the effect for another 12 or 14 seconds in any case.

Incidentally, the 3478 facilities are not available in FSXyet. I am hopeful of more FSX facilities in the future.

Regards

Pete

Link to comment
Share on other sites

Wow thank you very much Pete!!! :D

Note I inserted 25 because I see you don't switch button 12 (my 6) off until you press your own 0,0. Is that right? Is there any reason why you shouldn't switch it off when 0366 gets set?
Eventually (pretty quickly actually) the stack overflows and, bang, FS CTDs!
Now I know why my earlier versions didn't crash. They had less virtual buttons, but as soon as I added more than 6 or 7 buttons, FS started to CTD. This is also the reasons why I don't disconnect the last switch (that would be an extra button, at least the way I did it). And yes, I will use your version of course, it's indeed much cleaner, more efficient, etc., but I'm not a programmer, so I could have never come up with something like that :)

I'm at work now but as soon as I'm home I'll give it a try (I can't wait), although I'm sure it's fine now . As soon as I'm done with my "creation", I'll post the results here

Thanks again for your outstanding support Pete!!! :D

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