[REL] Console Useful Functions 0.3 (CCT update) -
cosmy - 15.01.2009
Console Useful Functions 0.3 by Cosmy
This plugin basically is same as Console Colored Text with some additions
Installation:
1) You need put "CUF.dll" in your plugin folder.
2) Open "server.cfg" and add this string: "plugins CUF".
Changelog:
v0.3
- SetConsoleTextColor() & GetConsoleTextColor() renamed to SetConsoleTextColors() & GetConsoleTextColors()
- Added printc(), printfc(), GetConsoleForegroundColor(), GetConsoleBackGroundColor(), SetConsoleTextColors()
- Name changed from CCT to CUF (Console Useful Functions)
- All code rewritten from scratch.
- Visual C++ 2010 Express project file.
- Now whole code is licensed under MIT.
- Added SetConsoleCursorPos(), GetConsoleCursorPos()
v0.2
- Added GetConsoleTextColor()
v0.1
- Initial version
post here comments, bugs etc...
Re: [REL] Console Colored Text 0.1 -
kalle - 15.01.2009
AWESOME!!!!
Great to notice the owner if something has to be fixed immedietaly like in a debug script
Re: [REL] Console Colored Text 0.1 -
cosmy - 15.01.2009
Quote:
Originally Posted by Michael Sund
AWESOME!!!!
Great to notice the owner if something has to be fixed immedietaly like in a debug script 
|
yeah
Re: [REL] Console Colored Text 0.1 -
Joske_Vermeulen - 15.01.2009
printc(#consolecolour, string);
printfc(#consolecolour, string, arguments);
Re: [REL] Console Colored Text 0.1 -
Basss - 15.01.2009
hehe nice work cosmy ^^ i'll try it
Re: [REL] Console Colored Text 0.1 -
Nimphious - 15.01.2009
awesome man :P
Re: [REL] Console Colored Text 0.1 -
boylett - 15.01.2009
Quote:
Originally Posted by ssǝן‾ʎ
|
What would be the point? You can't see the server console in Linux anyway.
Re: [REL] Console Colored Text 0.1 -
yom - 16.01.2009
Cool, same suggestion as Contador
Also, not possible to make background AND text colors? Like..
pawn Код:
printc(bg_color, txt_color, string[]);
printc(0x0000FF, 0xFFFFFF, "Some white text on blue background");
Could be awesome
Re: [REL] Console Colored Text 0.1 -
cosmy - 16.01.2009
Quote:
Originally Posted by 0rb
Cool, same suggestion as Contador
Also, not possible to make background AND text colors? Like..
pawn Код:
printc(bg_color, txt_color, string[]);
printc(0x0000FF, 0xFFFFFF, "Some white text on blue background");
Could be awesome 
|
in the next version ^^
EDIT:
isn't possible
Re: [REL] Console Colored Text 0.1 -
cosmy - 16.01.2009
Quote:
Originally Posted by ssǝן‾ʎ
Edit: Does this support both Windows and Linux?
|
nope. support only windows
Re: [REL] Console Colored Text 0.1 -
Nimphious - 16.01.2009
Don't triple post.
Also i thought this would colour all text, but i have to write text for it
Re: [REL] Console Colored Text 0.1 -
yom - 16.01.2009
Ohh, you should say in first post that we can do this also, for setting text and background colors:
pawn Код:
SetConsoleTextColor(CONSOLE_WHITE | BACKGROUND_BLUE);
Or maybe make some other #define like
pawn Код:
#define WHITE_AND_BLUE (CONSOLE_WHITE | BACKGROUND_BLUE)
EDIT: Even default cmd color codes are working!
pawn Код:
SetConsoleTextColor(0x1F);
That is still white text on blue background!
Color attributes are specified by two hex digits.
The first corresponds to the background color, the second to the foreground (text) color.
Each digit can be any of the following values:
Код:
0 = Black
1 = Blue
2 = Green
3 = Aqua
4 = Red
5 = Purple
6 = Yellow
7 = White
8 = Gray
9 = Light Blue
A = Light Green
B = Light Aqua
C = Light Red
D = Light Purple
E = Light Yellow
F = Bright White
Now is missing a function GetDefaultConsoleColors() in your plugin! (because it has bug actually, when console's default color isn't black/white). Can't wait
Last thing, can you please make it so we can choose where the background color will start and end (on the x axis). So this can maybe allow multiple colors in a single line. Because actually it starts at 0 (and ends at end of string, which make me think it's probably possible to set where it will start and where it will end too)
Re: [REL] Console Colored Text 0.1 -
cosmy - 17.01.2009
Quote:
Originally Posted by 0rb
Ohh, you should say in first post that we can do this also, for setting text and background colors:
pawn Код:
SetConsoleTextColor(CONSOLE_WHITE | BACKGROUND_BLUE);
Or maybe make some other #define like
pawn Код:
#define WHITE_AND_BLUE (CONSOLE_WHITE | BACKGROUND_BLUE)
EDIT: Even default cmd color codes are working!
pawn Код:
SetConsoleTextColor(0x1F);
That is still white text on blue background!
Color attributes are specified by two hex digits.
The first corresponds to the background color, the second to the foreground (text) color.
Each digit can be any of the following values:
Код:
0 = Black
1 = Blue
2 = Green
3 = Aqua
4 = Red
5 = Purple
6 = Yellow
7 = White
8 = Gray
9 = Light Blue
A = Light Green
B = Light Aqua
C = Light Red
D = Light Purple
E = Light Yellow
F = Bright White
Now is missing a function GetDefaultConsoleColors() in your plugin! (because it has bug actually, when console's default color isn't black/white). Can't wait
Last thing, can you please make it so we can choose where the background color will start and end (on the x axis). So this can maybe allow multiple colors in a single line. Because actually it starts at 0 (and ends at end of string, which make me think it's probably possible to set where it will start and where it will end too)
|
Quote:
Because actually it starts at 0 (and ends at end of string, which make me think it's probably possible to set where it will start and where it will end too)
|
the function "logprintf" do a new line... i can't do this feature
Quote:
Now is missing a function GetDefaultConsoleColors() in your plugin! (because it has bug actually, when console's default color isn't black/white). Can't wait 
|
you can use "0x0000 | 0x0007" for default color.
Re: [REL] Console Colored Text 0.1 -
yom - 17.01.2009
Quote:
Originally Posted by cosmy
you can use "0x0000 | 0x0007" for default color.
|
But that ISN'T my default color! My default color is blue/white not black/white.
Re: [REL] Console Colored Text 0.1 -
cosmy - 17.01.2009
Quote:
Originally Posted by 0rb
Quote:
Originally Posted by cosmy
you can use "0x0000 | 0x0007" for default color.
|
But that ISN'T my default color! My default color is blue/white not black/white.
|
:O what os you have?
Re: [REL] Console Colored Text 0.1 -
TrueCoppa - 17.01.2009
Quote:
Originally Posted by cosmy
Quote:
Originally Posted by 0rb
Quote:
Originally Posted by cosmy
you can use "0x0000 | 0x0007" for default color.
|
But that ISN'T my default color! My default color is blue/white not black/white.
|
:O what os you have?
|
The only things you can run an SAMP server is linux / windows.
The default console colours on every MS os is White on Black. And I'm assuming it's the same for linux.
Re: [REL] Console Colored Text 0.1 -
yom - 17.01.2009
Well i have XP, but i changed the default colors, now my default colors are blue background/white text, for every console window.
I think that it is possible to script a GetDefaultConsoleColors() (not in Pawn, obviously).
Of course i can also make my own define for my own default colors: #define MY_DEFAULT_COLORS 0x1F
Still, really nice work, looked the source, so simple
Re: [REL] Console Colored Text 0.2 (New version) -
cosmy - 17.01.2009
Released new version. Added GetConsoleTextColor();
Re: [REL] Console Colored Text 0.2 (New version) -
yom - 17.01.2009
Thanks, that fixed it
I suggest you change functions names
pawn Код:
SetConsoleColors(colors);
GetConsoleColors();
Re: [REL] Console Colored Text 0.2 (New version) -
cosmy - 17.01.2009
Quote:
Originally Posted by 0rb
Thanks, that fixed it
pawn Код:
new default_colors = GetConsoleTextColor();
SetConsoleTextColor(0x04); printf("test");
SetConsoleTextColor(default_colors);
I suggest you change functions names
pawn Код:
SetConsoleColors(colors); GetConsoleColors();
|
you can do this with pawn :P
pawn Код:
#define SetConsoleTextColors(%1) SetConsoleTextColor(%1)
#define GetConsoleTextColors(%1) GetConsoleTextColor(%1)
but thank's i will fix in the next version :P