Utils.matchPut = function(command, matches) { var wait = matches.match("...wait"); var queue = matches.match("Sorry, you may only type"); var match = 0; while (true) { script.waitForRoundtime(); script.put(command); match = matches.matchWait(); if (match == wait) { script.waitForRoundtime(); } else if (match == queue) { script.pause(0.5); } else { return match; } } }