Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
hpl2:amnesia:script_language_reference_and_guide:constants_and_enumerations [2013/01/13 23:35] thegreatcthulhu |
hpl2:amnesia:script_language_reference_and_guide:constants_and_enumerations [2013/01/15 04:42] thegreatcthulhu [Enumerations] |
||
---|---|---|---|
Line 281: | Line 281: | ||
// Later on: | // Later on: | ||
HealingPotion vial = HealingPotion::Small; | HealingPotion vial = HealingPotion::Small; | ||
- | HealingPotion leatherArmor = BodyArmor::Small; | + | HealingPotion leatherArmor = BodyArmor::Weak; |
Line 396: | Line 396: | ||
As you can see, unlike the decimal number system, which represents all numbers using 10 different symbols (0-9), the HEX number system represents those same numbers using 16 different symbols (0-F). It just so happens that each of the HEX digits perfectly corresponds to one of all possible 4-bit combinations. Any one byte can thus be represented by 2 HEX digits - all you need to do is to refer to the table above, pick two hexadecimal digits, and write them together. To get the corresponding binary number, just replace the HEX digit with its binary equivalent from the table. | As you can see, unlike the decimal number system, which represents all numbers using 10 different symbols (0-9), the HEX number system represents those same numbers using 16 different symbols (0-F). It just so happens that each of the HEX digits perfectly corresponds to one of all possible 4-bit combinations. Any one byte can thus be represented by 2 HEX digits - all you need to do is to refer to the table above, pick two hexadecimal digits, and write them together. To get the corresponding binary number, just replace the HEX digit with its binary equivalent from the table. | ||
- | Representing bytes using HEX system - some examples: | ||
<code> | <code> | ||
+ | Representing bytes using HEX system - some examples: | ||
+ | |||
+ | ---------------------- | ||
HEX binary | HEX binary | ||
---------------------- | ---------------------- | ||
Line 406: | Line 408: | ||
3A 0011 1010 | 3A 0011 1010 | ||
FC 1111 1100 | FC 1111 1100 | ||
+ | ---------------------- | ||
</code> | </code> | ||