summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 926f19bf0..a6a9a9cf9 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -5487,6 +5487,37 @@ BUILDIN(mes)
return true;
}
+/**
+ * Appends a message to the npc dialog, applying format string conversions (see
+ * sprintf).
+ *
+ * If a dialog doesn't exist yet, one is created.
+ *
+ * @code
+ * mes "<message>";
+ * @endcode
+ */
+BUILDIN(mesf)
+{
+ struct map_session_data *sd = script->rid2sd(st);
+ struct StringBuf buf;
+
+ if (sd == NULL)
+ return true;
+
+ StrBuf->Init(&buf);
+
+ if (!script_sprintf(st, 2, &buf)) {
+ StrBuf->Destroy(&buf);
+ return false;
+ }
+
+ clif->scriptmes(sd, st->oid, StrBuf->Value(&buf));
+ StrBuf->Destroy(&buf);
+
+ return true;
+}
+
/// Displays the button 'next' in the npc dialog.
/// The dialog text is cleared and the script continues when the button is pressed.
///
@@ -20275,6 +20306,7 @@ bool script_add_builtin(const struct script_function *buildin, bool override) {
else if( strcmp(buildin->name, "callfunc") == 0 ) script->buildin_callfunc_ref = n;
else if( strcmp(buildin->name, "getelementofarray") == 0 ) script->buildin_getelementofarray_ref = n;
else if( strcmp(buildin->name, "mes") == 0 ) script->buildin_mes_offset = script->buildin_count;
+ else if( strcmp(buildin->name, "mesf") == 0 ) script->buildin_mesf_offset = script->buildin_count;
else if( strcmp(buildin->name, "select") == 0 ) script->buildin_select_offset = script->buildin_count;
else if( strcmp(buildin->name, "_") == 0 ) script->buildin_lang_macro_offset = script->buildin_count;
else if( strcmp(buildin->name, "_$") == 0 ) script->buildin_lang_macro_fmtstring_offset = script->buildin_count;
@@ -20372,6 +20404,7 @@ void script_parse_builtin(void) {
// NPC interaction
BUILDIN_DEF(mes,"s"),
+ BUILDIN_DEF(mesf,"s*"),
BUILDIN_DEF(next,""),
BUILDIN_DEF(close,""),
BUILDIN_DEF(close2,""),