ColorBetween function. Fail.
#4

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
Just make sth like this:

Код:
stock ColorBetween(ColorA, ColorB) {
    new str[11];
    valstr(str,ColorA);
    new x = strval(str);
    valstr(str,ColorB);
    new y = strval(str);
    return x-y;
}

printf("0x%x",ColorBetween(0xF, 0xA));
//-> Gives u 0x5
But attention ColorA must be >= ColorB
Not an option at the moment.
Quote:
Originally Posted by Vince
Посмотреть сообщение
At the very least, the right shift in your HexToInt function for red is wrong. This should be 24. Also you should use the logical right shift (>>>, three shevrons) instead of the arithmetic right shift (>>). With the arithmetic right shift the number will be padded with the value of the MSB, so if you try to shift anything with a red value greater than 7F the number will be padded with 1 in the front and you will end up with very weird results.
I always have sucked with shifts. Could you show me what you mean?
Reply


Messages In This Thread
ColorBetween function. Fail. - by Crayder - 19.03.2015, 07:02
AW: ColorBetween function. Fail. - by Kaliber - 19.03.2015, 07:19
Re: ColorBetween function. Fail. - by Vince - 19.03.2015, 10:22
Re: ColorBetween function. Fail. - by Crayder - 19.03.2015, 12:06
AW: Re: ColorBetween function. Fail. - by Kaliber - 19.03.2015, 12:17
Re: ColorBetween function. Fail. - by Vince - 19.03.2015, 14:41
Re: ColorBetween function. Fail. - by Crayder - 19.03.2015, 20:43

Forum Jump:


Users browsing this thread: 2 Guest(s)