Binary Notation

From GECK
Jump to: navigation, search

Binary Notation is a new scripting feature added by xNVSE 6.1.0.


Whenever one may use NVSE Expressions, binary notation can be used to represent a number in binary. For example:

let iVar := 0b101010

0b101010 is equal to 52 in the standard decimal notation.

In this notation, 0b is purely decorative and used to tell the compiler that the number should be read as binary. The numbers following that are the bits, from highest to lowest. For the above example, the 0th bit is set to 0, while the 5th bit (the last bit, but the first number after "b") is set to 1.

This can prove useful when dealing with bitmasks and Bit Functions. For example, it can help clarify which bits are being set when using SetEyesFlags:

SetEyesFlags rEyes, (0b011)

Here, the first two bits are enabled, while the third one is disabled. This is much clearer than the following:

SetEyesFlags rEyes, 3

See Also