Signed 2's Complement
Definition
Signed 2's Complement
- 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 that only takes the s2c binary number form as an argument or input to color chat bubbles . 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.
- Source(s): https://www.cs.umd.edu/~meesh/cmsc411/local-links/numbers/node5.html#:~:text=The%20s2c%20form%20of%20a,that%20the%20number%20is%20positive.
- https://en.wikipedia.org/wiki/Two%27s_complement
- https://www.sciencedirect.com/topics/computer-science/twos-complement-number
- https://www.quora.com/What-is-the-difference-between-signed-2s-complement-and-2s-complement
- https://embeddedgurus.com/stack-overflow/2009/08/a-tutorial-on-signed-and-unsigned-integers/