How do I batch Automapping?

I’ve just pushed a change that adds initial scripting capabilities to Tiled, which can be executed from the “Console” view. With that change it is possible to batch automapping as requested here by executing the following script:

var document = tiled.documentManager.currentDocument;
var firstDocument = document;
while (document) {
    tiled.trigger("AutoMap");
    tiled.documentManager.switchToRightDocument()
    document = tiled.documentManager.currentDocument;
    if (document === firstDocument)
        break;
}

The script is a little strange, because the API is currently still very limited. :slight_smile:

2 Likes