friedrich Posted January 17, 2012 Report Posted January 17, 2012 Hi, there is a difference between VB 6 + VB 8. Manipulating was different using arrays. My question is: How Read + Write a single Flag value with Visual Basic 2008 ? Example: FSuipc - Offset 3366 - Var.Type U8 - Bit 0 .. 7 Thank you.
Paul Henty Posted January 17, 2012 Report Posted January 17, 2012 My question is: How Read + Write a single Flag value with Visual Basic 2008 ? Example: FSuipc - Offset 3366 - Var.Type U8 - Bit 0 .. 7 If you are using my DLL then the easiest way is to declare the offset as a 'BitArray' type. The sample application included with the DLL has an example of using a BitArray offset for the lights. Basically, you need to declare the offset as follows: Dim enginesOnFire As Offset(Of BitArray) = New FSUIPC.Offset(Of BitArray)(&H3366, 1)[/CODE]Note the size is 1 because the offset is 1 byte.Then after processing you can check if each bit is set by using an array index. This is 0 based so to test is bit 0 is set you use:[CODE]If enginesOnFire.Value(0) = True then ' Engine 1 on Fire!end if[/CODE]Engine 2 would be enginesOnFire.Value(1)Engine 3 would be enginesOnFire.Value(2)Engine 4 would be enginesOnFire.Value(3)You can also set and reset these bits by setting the value to True or False repectively e.g.[CODE]enginesOnFire.Value(2) = True[/CODE]although the documentation says this probably doesn't start a fire in the simulation, just sets the warning light.Paul
friedrich Posted January 17, 2012 Author Report Posted January 17, 2012 If you are using my DLL then the easiest way is to declare the offset as a 'BitArray' type. The sample application included with the DLL has an example of using a BitArray offset for the lights. Basically, you need to declare the offset as follows: Dim enginesOnFire As Offset(Of BitArray) = New FSUIPC.Offset(Of BitArray)(&H3366, 1)[/CODE]Note the size is 1 because the offset is 1 byte.Then after processing you can check if each bit is set by using an array index. This is 0 based so to test is bit 0 is set you use:[CODE]If enginesOnFire.Value(0) = True then ' Engine 1 on Fire!end if[/CODE]Engine 2 would be enginesOnFire.Value(1)Engine 3 would be enginesOnFire.Value(2)Engine 4 would be enginesOnFire.Value(3)You can also set and reset these bits by setting the value to True or False repectively e.g.[CODE]enginesOnFire.Value(2) = True[/CODE]although the documentation says this probably doesn't start a fire in the simulation, just sets the warning light.PaulMany thanks for you explanation. It's OK.regards
Pete Dowson Posted January 17, 2012 Report Posted January 17, 2012 although the documentation says this probably doesn't start a fire in the simulation, just sets the warning light. It certainly does set an engine fire in FSX. Don't know about FS9 though. Regards Pete
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now