Przeglądaj źródła

Clear script command(#2840)

Sader Fawall 7 lat temu
rodzic
commit
ead017b396
2 zmienionych plików z 31 dodań i 0 usunięć
  1. 16 0
      doc/script_commands.txt
  2. 15 0
      src/map/script.cpp

+ 16 - 0
doc/script_commands.txt

@@ -1150,6 +1150,22 @@ will terminate.
 
 ---------------------------------------
 
+*clear;
+
+This command will clear the dialog text and continue the script without player interaction.
+
+Example:
+	mes "This is how the 'clear' script command works.";
+	sleep2 3000;
+	clear; // This will clear the dialog and continue to the next one.
+	mes "I will show you again.";
+	sleep2 3000;
+	clear;
+	mes "Bye!";
+	close;
+
+---------------------------------------
+
 *close;
 
 This command will create a 'close' button in the message window for the invoking

+ 15 - 0
src/map/script.cpp

@@ -5087,6 +5087,20 @@ BUILDIN_FUNC(next)
 	return SCRIPT_CMD_SUCCESS;
 }
 
+/// Clears the dialog and continues the script without a next button.
+///
+/// clear;
+BUILDIN_FUNC(clear)
+{
+	TBL_PC* sd;
+
+	if (!script_rid2sd(sd))
+		return SCRIPT_CMD_FAILURE;
+
+	clif_scriptclear(sd, st->oid);
+	return SCRIPT_CMD_SUCCESS;
+}
+
 /// Ends the script and displays the button 'close' on the npc dialog.
 /// The dialog is closed when the button is pressed.
 ///
@@ -23782,6 +23796,7 @@ struct script_function buildin_func[] = {
 	// NPC interaction
 	BUILDIN_DEF(mes,"s*"),
 	BUILDIN_DEF(next,""),
+	BUILDIN_DEF(clear,""),
 	BUILDIN_DEF(close,""),
 	BUILDIN_DEF(close2,""),
 	BUILDIN_DEF(menu,"sl*"),