Signed 2's Complement

From Unofficial Homecoming Wiki
Revision as of 00:59, 4 March 2024 by BlackSpectre (talk | contribs) (Created page with "{{Definition |word=Signed 2's Complement |define= In computer science, Signed 2's complement (or sign 2's complement) (s2c) is a way to represent numbers in binary form. Essentially, it is a modification of the sign-magnitude form in which addition and subtraction work the way that you expect them to even though s2c numbers are in binary form. Why are we talking about this in City of Heroes? Well, because there is a slash command used to color chat bubbles that only ta...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Definition

Signed 2's Complement

  1. In computer science, Signed 2's complement (or sign 2's complement) (s2c) is a way to represent numbers in binary form. Essentially, it is a modification of the sign-magnitude form in which addition and subtraction work the way that you expect them to even though s2c numbers are in binary form.


Why are we talking about this in City of Heroes? Well, because there is a slash command used to color chat bubbles that only takes the s2c binary number form as an argument or input. The /option_set command takes the s2c number that we put into it, and then converts it into an 8-digit hexadecimal number (that represents colors) that the game can understand.

Hexadecimal color codes follow the 6-digit notation of RR (red) BB (blue) GG (green). City of Heroes also adds the alpha, or transparency, value at the end of the hexadecimal number, making it an 8-digit hexadecimal code (RRBBGGAA). Hexadecimal digits range from 0 to F (0-15), where 0 equals none (darkest) and F is the brightest form of that color. The alpha value ranges from completely transparent (0) to completely opaque (F). So, the brightest, purest color of red would be written as FF0000FF.

To get the s2c number that you need to color chat bubbles using /option_set, you'll first need to decide what color you want, and get the hexadecimal code for that number. There are plenty of websites that will give you both color codes and easy to use color pallets to choose your color and get the hexadecimal code.

Once you have your hex code, you'll need to find a hexadecimal to s2c converter. If you search the internet, you should find several. If you like, and it still exists, you might try this converter.



Also See: