JavaScript custom formats from command line

Hi!

I wrote an exporter with the new JavaScript API for a custom map format (a big step-up from the old Python plugin, I must say, so that’s very nice). It works perfectly fine when exporting from the editor, but I can’t get it to work when exporting using --export-map on the command line. Whether I use the shortname or rely on extension, Tiled says it can’t find a matching exporter. It also doesn’t show up in the --export-formats list

Do JS exporters simply not work on the command line at the moment or is there something I must do?

Ah, it could very well be that the scripts are not loaded yet before handling the command-line arguments. I’ll be sure to have a look at this soon. Thanks for bringing it up!

I’m glad to hear that you find the JavaScript API a big improvement over the Python one. I do realize that some will find a lot of functionality that was available in Python to be missing in JavaScript, but over time we’ll try to resolve that by adding more APIS. And on the other side, the JavaScript API can already do so much more than just adding custom formats.

Okay, great!

To be fair, the biggest improvement for me over Python is probably having proper documentation more than the API itself, but still. I like it :slight_smile:

I’ve just enabled scripted formats on the command line:

The feature will be included in today’s development snapshot (and eventually, in Tiled 1.4).

1 Like