Adds chatmes (scriptcommand). (#1924)

* Adds chatmes script command.
* chatmes writes a given message to the waitingroom of the NPC.
This commit is contained in:
Jeybla 2017-04-06 23:55:58 +02:00 committed by Aleos
parent 73b798bf12
commit 72fe4cd515
2 changed files with 36 additions and 0 deletions

View File

@ -6121,6 +6121,18 @@ the attached NPC will display the message.
---------------------------------------
*chatmes "<message>"{,"<NPC name>"};
This command will display a message in the waitingroom (chat) of the NPC.
If the <NPC name> option is given, then that NPC will display the message, else
the attached NPC will display the message.
If the NPC is not in a waitingroom, nothing happens.
// Everyone in the waitingroom will see this message:
chatmes "Waiting 5 minutes until the next match will start";
---------------------------------------
*setnpcdisplay("<npc name>", "<display name>", <class id>, <size>)
*setnpcdisplay("<npc name>", "<display name>", <class id>)
*setnpcdisplay("<npc name>", "<display name>")

View File

@ -14539,6 +14539,29 @@ BUILDIN_FUNC(npctalk)
return SCRIPT_CMD_SUCCESS;
}
/**
* Sends a message to the waitingroom of the invoking NPC.
* chatmes "<message>"{,"<NPC name>"};
* @author Jey
*/
BUILDIN_FUNC(chatmes)
{
struct npc_data* nd = NULL;
const char* str = script_getstr(st,2);
if (script_hasdata(st, 3))
nd = npc_name2id(script_getstr(st, 3));
else
nd = (struct npc_data *)map_id2bl(st->oid);
if (nd != NULL && nd->chat_id) {
char message[256];
safesnprintf(message, sizeof(message), "%s", str);
clif_GlobalMessage(map_id2bl(nd->chat_id), message, CHAT_WOS);
}
return SCRIPT_CMD_SUCCESS;
}
// change npc walkspeed [Valaris]
BUILDIN_FUNC(npcspeed)
{
@ -22550,6 +22573,7 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(movenpc,"sii?"), // [MouseJstr]
BUILDIN_DEF(message,"ss"), // [MouseJstr]
BUILDIN_DEF(npctalk,"s?"), // [Valaris]
BUILDIN_DEF(chatmes,"s?"), // [Jey]
BUILDIN_DEF(mobcount,"ss"),
BUILDIN_DEF(getlook,"i?"),
BUILDIN_DEF(getsavepoint,"i?"),