Difference between revisions of "Bot Playground/Commands/replyDialog"

From SmartBots Developers Docs
Jump to: navigation, search
(Created page with "{{DISPLAYTITLE:{{SUBPAGENAME}}}} <onlyinclude>Virtually "presses" a pop-up dialog button (which was displayed by an in-world script).</onlyinclude> <syntaxhighlight lang="jav...")
 
 
Line 23: Line 23:
 
<syntaxhighlight lang="javascript">
 
<syntaxhighlight lang="javascript">
 
Bot.on("script_dialog", function(event) {
 
Bot.on("script_dialog", function(event) {
  var buttons = event.buttons.split("\n");
+
Bot.replyDialog(event.channel, event.object_uuid, event.buttons[0]);
  Bot.replyDialog(event.channel, event.object_uuid, buttons[0]);
+
console.log("Got an dialog and answered with the first button: " + event.buttons[0]);
  console.log("Got an dialog and answer with the first button: " + buttons[0]);
+
 
});
 
});
 
</syntaxhighlight>
 
</syntaxhighlight>

Latest revision as of 19:04, 11 July 2016

Virtually "presses" a pop-up dialog button (which was displayed by an in-world script).

Bot.replyDialog(channel, object, button);

Reference

This command accepts the following parameters:

Variable Required Description


Input:
channel yes The dialog channel (either positive or negative value)
object yes UUID of the object which sent us the dialog
button yes The text of the dialog button to press
Output:
Function returns a Promise with the following data:
success bool true if command completed successfully
error string error string if command has failed

Examples

Bot.on("script_dialog", function(event) {
	Bot.replyDialog(event.channel, event.object_uuid, event.buttons[0]);
	console.log("Got an dialog and answered with the first button: " + event.buttons[0]);
});