Posted: Wed May 20, 2009 6:11 am Post subject: Print Color Codes
Okay, so if you've ever messed around with color Print() statements in ACS, you've probably noticed that some colors don't work properly, or at all. Here's a run-down of using color codes in ZDaemon ACS:
Code:
Print(s:"The word \cgcolor\c- is red.");
Using the "\cX" escape sequence will make a print statement start using the color code specified by X to color the line from that point until the next line, or until another color code is used to change the color again.
Possible values of X are:
Code:
a = Pink
b = Tan
c = White (see note 1)
d = Green
e = Brown
f = Gold (see note 2)
g = Red
h = Blue
i = Orange
j = White (see note 1)
k = Yellow (see note 2)
l = "Clear" (see note 3)
m = "Black" (see note 4)
- = Revert color to default
No other codes work, as far as I know...
Note 1: There are two white values, C and J. From what I can tell, these are both the same color on-screen, but when viewed from the console, you'll notice that they are not the same white color used for the standard console font.
Note 2: On-screen, you can clearly tell the difference between these, but they are quite similar (although not the same) in the console. It might be hard to distinguish these colors in the console if used together.
Note 3: The code L clears the color translation so the font in-game will appear exactly how is in the actual sprites (as red), however, ZDaemon doesn't account for this in the console, and the font is displayed as solid black, which looks rather ugly, in my opinion.
Note 4: The code M is supposed to be black, but it displays on-screen as the normal default color (gold) and is solid black in the console as the previous code. The only possible use this has is to hide text in the console (as blank lines) when something is printed to screen. Provided the console background is solid black, you would not be able to see it at all.
So, with all that said, here's what the (useful) colors look like:
The colors appear lighter in the console, but the shades are pretty accurate otherwise.
Joined: 17 Aug 2005 Location: Netherlands Clan: [QnB]
Posted: Wed May 20, 2009 1:48 pm Post subject:
I never realised some of the colors didn't work properly, while I've been messing around with this function quite often. Just used the right colors all the time I guess. Thanks for the information and investigation. It is useful I guess.
Also, something that Worst notified me of, is that printing player names is now possible (or always has). When you set up a Print() statement, you can use the "n:" type to print out a corresponding player's name. An example:
Code:
PrintBold(n:0, s:" pressed the switch everybody!");
Would print...
Code:
EarthQuake pressed the switch everybody!
The number 0 will return the activator of the script, but you should be able to substitute 0 for any player number. Seeing as the player numbers will change as players join or leave the server, it's not practical to use this to display other players' names specifically. However, it's plausible that you can use PlayerCount() to return the number of players, so you can display a random player name if you wish. This will not work in script types like OPEN, as the activator of those scripts is the "World".
Also, another bit of trickery you can use, is displaying one message for the activator of a script, and another message for everyone else. To do this, use a PrintBold() statement with your message to the whole server, and immediately after use a Print() statement that will display a message only to the activator and overwriting the previous PrintBold() statement.
Example:
Code:
PrintBold(s:"Hey everyone! ", n:0, s:" just opened a door!");
Print(s:"Hey, you just opened the door for everyone!");
Because of the behavior of Print/PrintBold, any subsequent messages will be overwritten if there is no delay between them. For the activator, if this method is used, the PrintBold message will still be displayed in the console, but will not be seen on-screen, except by other players. This can be used in a lot of different ways, so be sure to experiment with it.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum