Posts: 348
Threads: 26
Joined: Oct 2012
Reputation:
0
Not sure but you could save it as a varchar , load it and store it into your variable and finally setplayercolor with your variable
Posts: 10,066
Threads: 38
Joined: Sep 2007
Reputation:
0
Colors are numbers. You only need a regular integer field. Only use conversion functions when the value needs to be converted from an input string (i.e. params from a command or dialog box inputtext).
Posts: 1,733
Threads: 20
Joined: Nov 2010
Reputation:
0
As Vince said, colors are just numbers.
Color 0xFFFFFFFF is exactly the same as color -1.
It's just so we can read it easier.
Colors in hex are made up by red, green, blue and transparency values, each represented by 2 digits.
Take 0x12345678 for example.
The "12" represents the red value, "34" is green, "56" is blue and "78" is transparency.
The 0x tells the compiler that the following digits are hex-codes.
Each digit is a value from 0 to 15, where value above 10 are represented by A (10), B(11), C(12), D(13), E(14) and F(15).
The "12" isn't 12, as hex numbers don't work with base-10 value, they use base-16 values.
To convert to a decimal value:
(1 * 16^7) + (2 * 16^6) + (3 * 16^5) + (4 * 16^4) + (5 * 16^3) + (6 * 16^2) + (7 * 16^1) + (8 * 16^0)
= 268435456 + 33554432 + 3145728 + 262144 + 20480 + 1536 + 112 + 8
= 305419896
So value 0x12345678 equals integer number 305419896, which can be stored safely in an integer field.