Difference between revisions of "Flag field"
(started tutorial) |
|||
Line 6: | Line 6: | ||
==Decimal to binary== | ==Decimal to binary== | ||
Let's say you see an object in the game and want to find out what flags does it has. You see "164" as a flag being used on the object. As mentioned before, that number can be obtained by adding the decimal values up but it is very difficult to choose which decimal values add up to "164." Go to Calculator and select "Dec." Type in "164." Now select "Bin" and you will see "10100100." You can look at the table and see what binary numbers add up to that. Flags "10000000", "100000", and "100" were used. | Let's say you see an object in the game and want to find out what flags does it has. You see "164" as a flag being used on the object. As mentioned before, that number can be obtained by adding the decimal values up but it is very difficult to choose which decimal values add up to "164." Go to Calculator and select "Dec." Type in "164." Now select "Bin" and you will see "10100100." You can look at the table and see what binary numbers add up to that. Flags "10000000", "100000", and "100" were used. | ||
+ | |||
+ | ==External link== | ||
+ | {{GTAF|post|106678|1126960|Brief explanation of turning them into bits}} - by {{U|Barton Waterduck}} | ||
[[Category:Tutorials]] | [[Category:Tutorials]] |
Revision as of 09:10, 1 December 2009
Binary to decimal conversion is useful when trying to use and understand most flags that GTA uses, like object flags. The files uses decimal values that can be obtained from binary values. A reliable tool to use is Microsoft's Calculator in scientific mode. This tutorial will be using object flags as an example.
Binary to decimal
Let's say you want to have your object have a wet effect when it's raining and has an alpha transparency to it. The binary value for a wet effect is "1" and for alpha transparency is "100." Add the two up and you get "101." Go to Calculator and you see a row of three-letter words "Hex, Dec, Oct, Bin." Select "Bin" for binary. Type in your value "101" into the calculator. Now select "Dec" for decimal and it will show "5." This value is the value to use as your object flag in the IDE file. Notice that "5" can also be obtained by adding "1" and "4" together.
Decimal to binary
Let's say you see an object in the game and want to find out what flags does it has. You see "164" as a flag being used on the object. As mentioned before, that number can be obtained by adding the decimal values up but it is very difficult to choose which decimal values add up to "164." Go to Calculator and select "Dec." Type in "164." Now select "Bin" and you will see "10100100." You can look at the table and see what binary numbers add up to that. Flags "10000000", "100000", and "100" were used.
External link
GTAForums: Brief explanation of turning them into bits - by Barton Waterduck