The way the chat is parsed, I don't think this is trivial. I tried this as a macro: Starting !wait 500 Ending And the output is: 10:51AMThorsten (GM): Starting Ending 10:51AM(From WAIT): 500 ms Which means macros don't wait for something to complete before going on to the next command to output into chat. That "From WAIT" line is a debug message in the !wait API I cobbled together. Edit: Okay, so what if "wait" could take a command, and then execute that after the wait. That might work. Or take multiple commands and execute them with a wait in between each. Which do you think would work best, here? What are your use cases? Is it preferable to specify a custom wait between each command, or should it be just a standard wait, and then execute commands in order with the specified wait in between? I can probably steal some code from GroupCheck to make this work. For reference, this is a wait script that does nothing but wait: // VERSION INFO
var Wait_Author = "Thorsten";
var Wait_Version = "1.0";
var Wait_LastUpdated = 1490451480;
// FUNCTION DECLARATION
var WaitScript = WaitScript || {};
on("chat:message", function (msg) {
if (msg.type != "api") return;
if (msg.content.split(" ", 1)[0] === "!wait") {
msg.who = msg.who.replace(" (GM)", "").split(" ", 1)[0];
msg.content = msg.content.replace(/<br\/>\n/g, ' ').replace(/({{(.*?)}})/g, " $2 ");
var n = msg.content.split(" ", 2)[1];
if (!WaitScript.isPositiveInteger(n)) {
sendChat("WAIT", "/w " + msg.who + " You did not give a wait time (in ms).");
return;
}
if (n > 500) {
sendChat("WAIT", "/w " + msg.who + " Waiting for more than 500ms is not supported, as it may crash the API sandbox.");
return;
}
WaitScript.Wait(n);
sendChat("WAIT", "/w " + msg.who + " " + n + " ms");
}
});
on("ready", function () {
log("-=> Wait v" + Wait_Version + " <=- [" + (new Date(Wait_LastUpdated * 1000)) + "]");
//log (Date.now().toString().substr(0, 10));
});
WaitScript.Wait = function (ms) {
var d = new Date();
var d2 = null;
do { d2 = new Date(); }
while(d2-d < ms);
}
WaitScript.isPositiveInteger = function (n) {
return n >>> 0 === parseFloat(n);
}