Thread: Problem: Text
View Single Post
  #10  
Old 01-27-2006, 02:30 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
This should work:
PHP Code:
function getAlignmentColor(value) {
  if (
value<=0) return {64,0,0};
  if (
value<=26) return {128+int(127*(value-1)/25),64-int(64*(value-1)/25),64-int(64*(value-1)/25)};
  if (
value<=49) return {255,int(255*(value-26)/24),int(255*(value-26)/24)};
  if (
value<=55) return {255,255,255};
  if (
value<=60) return {255-int(127*(value-55)/5),255,255-int(127*(value-55)/5)};
  if (
value<=70) return {128-int(128*(value-61)/10),255,128+int(127*(value-61)/10)};
  if (
value<=99) return {0,255-int(255*(value-70)/29),255};
  return {
224,196,0};

It's returning an array of {red,green,blue}, then you only need to use it like this:
PHP Code:
acolors getAlignmentColors(player.ap);
changeimgcolors(indexacolors[0]/255acolors[1]/255acolors[2]/2551); 
Reply With Quote