Quote:
Originally Posted by Stefan
Generating images on-the-fly by script is quite interesting though, might need some optimization for big images. The function convertrgbtoascii() is missing though ?
|
Yeah, it is, forgot! Thanks for reminding me.
Edited the top post.
And these are the functions I was thinking of using instead of the multidimensional arrays:
NPC Code:
function ColorToInt(r, g, b) {
return r * 256 ^ 2 + 256 * g + b;
}
NPC Code:
function IntToColor(i) {
return {int((i / 256 ^ 2)) % 256, int((i / 256)) % 256, (i - 256 ^ 2) % 256};
}
ColorToInt(r, g, b) converts 3 numbers in to it's own unique number (thanks to PFA for that function/idea)
IntToColor(i) outputs the r, g, b generated by ColorToInt.