whQQps Posted December 28, 2023 Report Posted December 28, 2023 (edited) Hello. I'm trying to make a simple switchbox program with Csharp using FSUIPC Client dll. offset declarations as below. private Offset<int> alternatoroffset = new Offset<int>("alternator", 0x3101); private Offset<int> masterbatteryoffset = new Offset<int>("masterbattery", 0x3102); private Offset<int> avionpwrofset = new Offset<int>("avionicspower", 0x3103); For control, I assigned the offset values to the labels as below. lblalter.Text = this.alternatoroffset.Value.ToString(); lblavion.Text = this.avionpwrofset.Value.ToString(); lblmastbat .Text= this.masterbateryoffset.Value.ToString(); When avionics is off, the alternator offset value is 256 and 257. When avionics is on, the alternator offset is 65792 and 65793. I expect it to be 1 and 0. can you help me what is my mistake? Edited December 28, 2023 by whQQps
Paul Henty Posted December 30, 2023 Report Posted December 30, 2023 Hi, All of these offsets are only 1 byte in length. This can be seen from the FSUIPC Offsets document: e,g,0x3101 By declaring these offsets with type <int> you are reading 4 bytes instead of 1. For offset 0x3101 you are also reading 3102, 3103 and 3104 into one variable. You must declare these offsets to be an integer of length 1. The C# type for this is either byte (unsigned: + values only) or sbyte (signed: + and - values). Since the possible values for these offsets are only 0 and 1, just use <byte> like this: private Offset<byte> alternatoroffset = new Offset<byte>("alternator", 0x3101); private Offset<byte> masterbatteryoffset = new Offset<byte>("masterbattery", 0x3102); private Offset<byte> avionpwrofset = new Offset<byte>("avionicspower", 0x3103); For more information on which C# type to use with different size offsets, please see the "Offset Types Chart" in the downloads section of the website: http://fsuipc.paulhenty.com/#downloads Paul
whQQps Posted December 30, 2023 Author Report Posted December 30, 2023 it's working now. Thanks for your help :):)
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