Error with export CSV

Error when exporting CSV

Hello, when exporting in CSV I get this:

0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1;

A comma is missing here:

0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0 <-------------
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1;

It should look like this:

0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1;

That is strange, because the CSV plugin doesn’t put a semicolon at the end.

CSV files generally do not have a comma at the end of each line. Why do you think it should be there? I would suggest you adapt your loading code such that you don’t need that comma.

But in the language I use to make video games, the values must be separated by a comma, otherwise the compiler gives an error.

program test;

private

sbyte animManzanasMenuInicial1 [7][21] =
0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0;

begin

Right, so you can’t copy/paste the CSV file into your code. You would either need to write your own plugin that outputs in the format you need, or write a bit of code that reads and parses the CSV file.

You know what, since documenting the Python plugin was anyway a long-overdue task, I’ve written a page about it now, featuring an example that writes a map in your desired format.

Just note that the Python plugin currently doesn’t ship with the 64-bit version of Tiled for Windows (#1762). So if you’re on Windows, make sure you’re using the 32-bit version.

Hello
I have pasted the code that is in:
http://doc.mapeditor.org/en/latest/manual/python/
In a .txt file and then I saved it with .py extension
When I give to export, the option “Example” does not appear.

What am I doing wrong?

I Have python 3.6 and 2.7

Code in txt file

Sin título

File py in python directory

Sin título-1

Extensions format in export

Sin título-2

I have also placed it in the Tiled directory but it did not work either

Sin título

In tiled directory

Sin título-1

The problem is that you didn’t put the script in the right location. In the documentation I wrote that you need to put the scripts in the ~/.tiled folder.

The ~ means your home directory. I can never remember where this is on Windows, but you could try to open a Command Prompt (Win+R, cmd) and type echo %HOME% to find out. Also note that the directory is required to have that dot at the start (on Linux and macOS, these are hidden folders).

Ok I have it

As a note to add, to create the name of the folder in windows it is necessary to do it like this:
.tile.

If you do it like that
.tiled
Windows will not let you so you must add another point at the end to get
.tiled

Thanks for all :slight_smile:

I should probably change the folder on Windows or make it configurable…

Nice to hear you got it to work!