Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: Xmair on Dec 04, 2015, 04:43 PM

Title: Echo Colours
Post by: Xmair on Dec 04, 2015, 04:43 PM
Hello everybody, I've a question, can we convert rgb and hex values to echo values like [#FF0000]/RGB(255,0,0) is \x000304.
Title: Re: Echo Colours
Post by: KAKAN on Dec 04, 2015, 04:44 PM
Quote from: Xmair on Dec 04, 2015, 04:43 PMHello everybody, I've a question, can we convert rgb values to echo values like [#FF0000] is \x000304.
i Think we can't
I need that too!
Btw what u mean? Hex to echo cols or RGB to echo cols?
Title: Re: Echo Colours
Post by: Xmair on Dec 04, 2015, 04:48 PM
Edited.
Title: Re: Echo Colours
Post by: Thijn on Dec 04, 2015, 05:53 PM
What do you need those for?
Title: Re: Echo Colours
Post by: Skirmant on Dec 04, 2015, 09:29 PM
I wrote a function for my server.

BASE16_TABLE <- "0123456789ABCDEF";

function rgbToTxt(rgb) {
  local str = "[#"+
  BASE16_TABLE[(rgb.r&0xf0) >> 4].tochar()+BASE16_TABLE[rgb.r&0x0f].tochar()+
  BASE16_TABLE[(rgb.g&0xf0) >> 4].tochar()+BASE16_TABLE[rgb.g&0x0f].tochar()+
  BASE16_TABLE[(rgb.b&0xf0) >> 4].tochar()+BASE16_TABLE[rgb.b&0x0f].tochar()+"]";
  return str;
}
Title: Re: Echo Colours
Post by: KAKAN on Dec 05, 2015, 07:01 AM
The index 'r' doesn't exist. It doesn't work, can you tell us how to make it work?
This is what I tried:- exec rgbToTxt(255)
Title: Re: Echo Colours
Post by: Xmair on Dec 05, 2015, 12:53 PM
Try using exec rgbToTxt(RGB(255,0.0));
Anyway, I needed the echo one as I don't have all the echo colors. @Thijn
Title: Re: Echo Colours
Post by: KAKAN on Dec 05, 2015, 01:48 PM
const ICOL_WHITE    = "\x000300";
const ICOL_BLACK    = "\x000301";
const ICOL_BLUE     = "\x000302";
const ICOL_GREEN    = "\x000303";
const ICOL_RED      = "\x000304";
const ICOL_BROWN    = "\x000305";
const ICOL_PURPLE   = "\x000306";
const ICOL_ORANGE   = "\x000307";
const ICOL_YELLOW   = "\x000308";
const ICOL_LGREEN   = "\x000309";
const ICOL_CYAN     = "\x000310";
const ICOL_LCYAN    = "\x000311";
const ICOL_LBLUE    = "\x000312";
const ICOL_PINK     = "\x000313";
const ICOL_GREY     = "\x000314";
const ICOL_LGREY    = "\x000315";
const ICOL          = "\x0003";
const ICOL_BOLD     = "\x0002";
const ICOL_ULINE    = "\x0031";
All the colors^^^

I found a better way to do it.
Title: Re: Echo Colours
Post by: EK.IceFlake on Dec 05, 2015, 01:49 PM
bold and underline is a color? never knew!
Title: Re: Echo Colours
Post by: KAKAN on Dec 05, 2015, 01:55 PM
Quote from: NE.CrystalBlue on Dec 05, 2015, 01:49 PMbold and underline is a color? never knew!
No they aren't!
These are just the things I got from the old FPS Echo scripts.