summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnnieRuru <jeankof@ymail.com>2015-12-14 02:54:25 +0800
committerHaru <haru@dotalux.com>2015-12-20 17:58:29 +0100
commitb5c5e6c91b0b7009dc17492419c1f116fbd7d037 (patch)
treeb23af7c809d44dc1240699190b51135cd2c49fd8
parente7c09d41c6106a0939f981162df695b224a1f6f6 (diff)
downloadhercules-b5c5e6c91b0b7009dc17492419c1f116fbd7d037.tar.gz
hercules-b5c5e6c91b0b7009dc17492419c1f116fbd7d037.tar.bz2
hercules-b5c5e6c91b0b7009dc17492419c1f116fbd7d037.tar.xz
hercules-b5c5e6c91b0b7009dc17492419c1f116fbd7d037.zip
Add color constants for announcement and mes
Added F_MesColor helper function Closes #897 as merged Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r--db/const.txt21
-rw-r--r--doc/script_commands.txt19
-rw-r--r--npc/other/Global_Functions.txt8
3 files changed, 42 insertions, 6 deletions
diff --git a/db/const.txt b/db/const.txt
index 56437d2e2..421faa406 100644
--- a/db/const.txt
+++ b/db/const.txt
@@ -3547,3 +3547,24 @@ UNITTYPE_MOB 3
UNITTYPE_HOM 4
UNITTYPE_MER 5
UNITTYPE_ELEM 6
+
+C_AQUA 0x00FFFF
+C_BLACK 0x000000
+C_BLUE 0x0000FF
+C_GRAY 0x808080
+C_GREEN 0x008000
+C_LIME 0x00FF00
+C_MAROON 0x800000
+C_NAVY 0x000080
+C_OLIVE 0x808000
+C_ORANGE 0xFFA500
+C_PURPLE 0x800080
+C_RED 0xFF0000
+C_SILVER 0xC0C0C0
+C_TEAL 0x008080
+C_WHITE 0xFFFFFF
+C_YELLOW 0xFFFF00
+C_PINK 0xFFC0CB
+C_CHOCOLATE 0xD2691E
+C_GOLD 0xFFD700
+C_VIOLET 0xEE82EE
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index 1f6c40996..2dd4fa575 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -1201,11 +1201,14 @@ contain three hexadecimal numbers representing colors as if they were HTML
colors - ^FF0000 is bright red, ^00FF00 is bright green, ^0000FF is bright
blue, ^000000 is black. ^FF00FF is a pure magenta, but it's also a color
that is considered transparent whenever the client is drawing windows on
-screen, so printing text in that color will have kind of a weird effect.
-Once you've set a text's color to something, you have to set it back to
-black unless you want all the rest of the text be in that color:
+screen, so printing text in that color will have kind of a weird effect.
+You may also use C_ constants accompany with "F_MesColor" function for the
+color effect, see the full list of the available ones in 'db/const.txt'
+under 'C_'. Once you've set a text's color to something, you have to set
+it back to black unless you want all the rest of the text be in that color:
mes "This is ^FF0000 red ^000000 and this is ^00FF00 green, ^000000 so.";
+ mes callfunc("F_MesColor", C_BLUE) +"This message is now in BLUE";
Notice that the text coloring is handled purely by the client. If you use
non-English characters, the color codes might get screwed if they stick to
@@ -6591,7 +6594,7 @@ client and appears always green.
This command will broadcast a message to all or most players, similar to
@kami/@kamib GM commands.
- announce "This will be shown to everyone at all in yellow.",0;
+ announce "This will be shown to everyone at all in yellow.", bc_all;
The region the broadcast is heard in (target), source of the broadcast and
the color the message will come up as is determined by the flags.
@@ -6628,13 +6631,17 @@ special flag is ignored. Optional parameters may not work well (or at all)
depending on a game client used.
The color parameter is a single number which can be in hexadecimal
-notation.
+notation. C_ constant can also be used for color effects, see the full list
+of the available ones in 'db/const.txt' under 'C_'.
For example:
- announce "This will be shown to everyone at all in green.",bc_all,0x00FF00;
+ announce "This announcement will be shown to everyone in green.",bc_all,0x00FF00;
Will display a global announce in green. The color format is in RGB
(0xRRGGBB).
+Another example:
+ announce "This announcement will shown to everyone in purple.",bc_all,C_PURPLE;
+
In official scripts only two font-weights (types) are used:
- normal (FW_NORMAL = 400, default),
- bold (FW_BOLD = 700).
diff --git a/npc/other/Global_Functions.txt b/npc/other/Global_Functions.txt
index 9fb4949fa..8f7899555 100644
--- a/npc/other/Global_Functions.txt
+++ b/npc/other/Global_Functions.txt
@@ -353,3 +353,11 @@ function script F_ShuffleNumbers {
}
return .@count;
}
+
+//== Function F_MesColor ===================================
+// Function to colorize npc dialog without having to memorize the color code
+// Examples:
+// mes callfunc("F_MesColor", C_BLUE) +"This message is now in BLUE";
+function script F_MesColor {
+ return sprintf("^%06X", min(getarg(0), 0xFFFFFF));
+}