diff options
author | Haru <haru@dotalux.com> | 2015-12-22 01:55:24 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2015-12-22 01:55:24 +0100 |
commit | b814cbd6230c2c1d8dad71331c3650da70916cf0 (patch) | |
tree | a62a3fc6bcf210bd494b0b75b02b8700f1b44a83 | |
parent | 1c3378e161859ca6da728ea5cb0a5dc07fff5364 (diff) | |
parent | 19d83e65e83887a9f15353e626eaab57d7f86a74 (diff) | |
download | hercules-b814cbd6230c2c1d8dad71331c3650da70916cf0.tar.gz hercules-b814cbd6230c2c1d8dad71331c3650da70916cf0.tar.bz2 hercules-b814cbd6230c2c1d8dad71331c3650da70916cf0.tar.xz hercules-b814cbd6230c2c1d8dad71331c3650da70916cf0.zip |
Merge branch 'AnnieRuru-request_12' into hercules
-rw-r--r-- | doc/script_commands.txt | 12 | ||||
-rw-r--r-- | src/map/script.c | 51 |
2 files changed, 41 insertions, 22 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 852a003b7..ef4816889 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -4091,18 +4091,20 @@ Note: rid2name may not produce correct character names since rid means --------------------------------------- +*message <account ID>,"<message>"; *message "<character name>","<message>"; That command will send a message to the chat window of the character -specified by name. The text will also appear above the head of that -character. It will not be seen by anyone else. +specified by account ID or name. The text will also appear above the head +of that character. It will not be seen by anyone else. --------------------------------------- -*dispbottom "<message>"; +*dispbottom "<message>"{,<color>}; -This command will send the given message into the invoking character's -chat window. +This command will send the given message into the invoking character's +chat window. The color format is in RGB (0xRRGGBB), and default to green +if <color> field is left out. --------------------------------------- diff --git a/src/map/script.c b/src/map/script.c index fedfc895c..7a5292159 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -13610,16 +13610,28 @@ BUILDIN(atcommand) { return ret; } -/*========================================== - * Displays a message for the player only (like system messages like "you got an apple" ) - *------------------------------------------*/ +/** + * Displays a message for the player only (like system messages like "you got an apple") + * + * @code + * dispbottom "<message>"{,<color>}; + * @endcode + */ BUILDIN(dispbottom) { - TBL_PC *sd=script->rid2sd(st); - const char *message; - message=script_getstr(st,2); - if(sd) - clif_disp_onlyself(sd,message,(int)strlen(message)); + TBL_PC *sd = script->rid2sd(st); + const char *message = script_getstr(st,2); + + if (sd == NULL) + return true; + + if (script_hasdata(st,3)) { + int color = script_getnum(st,3); + clif->messagecolor_self(sd->fd, color, message); + } else { + clif_disp_onlyself(sd, message, (int)strlen(message)); + } + return true; } @@ -13834,16 +13846,21 @@ BUILDIN(movenpc) { /*========================================== * message [MouseJstr] *------------------------------------------*/ -BUILDIN(message) { - const char *msg,*player; - TBL_PC *pl_sd = NULL; +BUILDIN(message) +{ + const char *message; + TBL_PC *sd = NULL; - player = script_getstr(st,2); - msg = script_getstr(st,3); + if (script_isstringtype(st,2)) + sd = script->nick2sd(st, script_getstr(st,2)); + else + sd = script->id2sd(st, script_getnum(st,2)); - if ((pl_sd = script->nick2sd(st, (char*)player)) == NULL) + if (sd == NULL) return true; - clif->message(pl_sd->fd, msg); + + message = script_getstr(st,3); + clif->message(sd->fd, message); return true; } @@ -20358,7 +20375,7 @@ void script_parse_builtin(void) { BUILDIN_DEF(atcommand,"s"), // [MouseJstr] BUILDIN_DEF2(atcommand,"charcommand","s"), // [MouseJstr] BUILDIN_DEF(movenpc,"sii?"), // [MouseJstr] - BUILDIN_DEF(message,"ss"), // [MouseJstr] + BUILDIN_DEF(message,"vs"), // [MouseJstr] BUILDIN_DEF(npctalk,"s?"), // [Valaris] BUILDIN_DEF(mobcount,"ss"), BUILDIN_DEF(getlook,"i"), @@ -20391,7 +20408,7 @@ void script_parse_builtin(void) { BUILDIN_DEF(deletepset,"i"), // Delete a pattern set [MouseJstr] BUILDIN_DEF(pcre_match,"ss"), #endif - BUILDIN_DEF(dispbottom,"s"), //added from jA [Lupus] + BUILDIN_DEF(dispbottom,"s?"), //added from jA [Lupus] BUILDIN_DEF(getusersname,""), BUILDIN_DEF(recovery,""), BUILDIN_DEF(getpetinfo,"i"), |