GCLI print() in color

pastafresco

New member
Is there any way to print to the GCLI in color?

I tend to print reminders and information on the console, but it gets overrun by all the standard adventuring text. If I could print my reminders and such in color, it would be easier to see (not to mention look cool and professional 8)).

When i say print, i'm referring to the ash command print(string st)
 

Nightmist

Member
Well... there is a way to do this, thanks to mafia's weird attempts to "make any HTML in the GCLI show up as it would in a browser". So this works:
Code:
string CGCLI( string Text, string HexColour)
{
 return( "<font color=#"+HexColour+">"+Text+"</font>");
}

print( CGCLI( "Test", "FF0000")+"ing.");
Thats a "RRGGBB" colour code, 00-FF. But you should be fine working it out.
 

Nightmist

Member
[quote author=Alexander Daychilde link=topic=572.msg2753#msg2753 date=1162892293]
What, no CSS? **pout**

( ;D ;D ;D )
[/quote]
*Stares blankly*... Righteo >>.

If your printing reminders at the end of the script and all the text is "distracting" there is a way to script a "cls"... its a open/close html tag without any text in-between needed. (Or does "cls" actually work in scripts? because last time I checked it didn't, but that was a wee while back.)
 

holatuwol

Developer
... I thought I fixed that bug. I guess I reintroduced it when I was trying to fix something else. So, uh, this will probably not work in the next release.
 

Nightmist

Member
[quote author=holatuwol link=topic=572.msg2759#msg2759 date=1162931993]
... I thought I fixed that bug. I guess I reintroduced it when I was trying to fix something else. So, uh, this will probably not work in the next release.
[/quote]
Not going to add a "colour" function either then? Heh Back to "clearing" the GCLI with a many-o print(".");
 

holatuwol

Developer
void print( string message, string color ): Added.

Note if you give an actual hex string, it needs to be prefixed with a # sign, as I don't think the built-in HTML interpreter will recognize it otherwise.  You can, alternatively, just say "red" or "blue" if you use simple colors.
 

pastafresco

New member
[quote author=holatuwol link=topic=572.msg2763#msg2763 date=1162960224]
void print( string message, string color ): Added.[/quote]

Awesome! This will come in handy in my scripts

Thanks holatuwol!
 

Nightmist

Member
Evil thread necro... but the question is directly related to this added color functionality.
Does anyone know how to print to the same line? (I'm looking to create multicolor lines of text)

Failed:
Code:
print( "You "+print( "Win", "#00FF00"))
Since its a "void" return so it doesn't actually return anything so the coloured text is just printed then "You void" is printed under it.

Any help is appreciated ^^.
 

holatuwol

Developer
I'll go ahead and replace print(string,string) with print_html(string).

void print( string message, string color ): Removed.
void print_html( string message ): Added.
 

Nightmist

Member
[quote author=holatuwol link=topic=572.msg3521#msg3521 date=1170278593]
I'll go ahead and replace print(string,string) with print_html(string).

void print( string message, string color ): Removed.
void print_html( string message ): Added.
[/quote]
Yay ^^. Thanks for that. *Evil laugh* Time for some hideous eye watering multicolor text pain.
 
Yay!!!

On another note, If anyone needs help with moving from "void print( string message, string color ):" to void print( string message, string color ): Let me know, and I will write a wrapper for you so you can continue to just call the old function name which will be a function in your script instead of a kolmafia internal function.
 
Top