The status file looks like it contains some really valuable data I'd like to parse but I cannot for the life of me figure out the new flags system. Anyone able to point me in the right direction?
Cheers
Cheers
Yup, I've read that but still no clearer on it even after looking at the examples.
In the first example above 16842765 (0x0101000d) has flags 24, 16, 3, 2, 0: In main ship, Mass
locked, Shields up, Landing gear down, Docked
You need to extract the needed bits.
The number 16842765 or 0x0101000d looks like this:
1000000010000000000001101
You see, bit 0, 2, 3, 16 and 24 are set. Now you have to extract the bits you want to read. For example: Bit 8 (Ligths on) is 0 -> not set.
You dont write zeros on the left side of binäry or hex numbers
But its just optical and also syntax is correct in most programing languages. Its just an unwriten law
Example
Do: 0b1000000010000000000001101
Dont: 0b01000000010000000000001101
Do: 0x101000d
Also do (4 full visual bytes): 0x0101000d
Dont (first zero is unnecessary): 0x00101000d
Btw... if you use hexadezimal or binary numbers in comments or in posts, always use prefixes. After some Month you dont know which type of number you used... 10001 can be decimal, hex or binary
Any chance you could show me the example of bits 0, 2, 3, 16, 24, 25 & 26 set?
Thanks for your help BTW.
To check whether the flag at bit 25 is set:
bool result = ((allflags & 0x02000000)>0);
For bit 26 the mask is 0x04000000.
So, for your 0, 2, 3, 16, 24, 25 & 26 example, the result = 0x1 | 0x4 | 0x8 | 0x10000 | 0x1000000 | 0x2000000 | 0x4000000 = 0x701000D
Yup, its the 25 & 26 i need to visualise, if I can't see them as mLine suggested I have no idea how to parse the string.
what would it look like if 0, 2, 3, 16, 24, 25 & 26 were set? 111000000010000000000001101?
var flags = 16842765 // you got this from status.json
// flag constances
const var flagDocked = 0x01;
const var flagLanded = 0x02;
...
const var flagFsdMasslocked = 0x010000;
...
const var flagInFighter = 0x02000000;
// check for Fsd Masslocked
if(flags & flagFsdMasslocked) {
// Fsd Masslocked bit is set
}
// check for In Fighter
if(flags & flagInFighter) {
// In Fighter bit is set
}
Sorry, but if you still dont know what to do, you should first learn basic programming.
Guys - Just wanted to say a big thanks again. I've figured it all out now, it's actually really simple to get the flags and all of your examples now make complete sense. Sorry for being such a dimwit - I think I was just over complicating matters in my head!