Dalius's blog

Sunday, June 23, 2019

Card-a-mon tutorial No. 3: Import and Export

This is third tutorial about Card-a-mon. It is recommended to check first and second tutorials if you have not done that yet.

You can watch video, read tutorial or you can do both:

We already know how to create a game and as well we know how to upload our own images. Now we might need to import or export our data. E.g. we might want to give our texts for somebody to check for spelling mistakes, fix them and return to us without revealing all the details about the game.

step01.png

So for this tutorial we will import some images and create card with two fields. Image field with an image of a number and text field with, well, some text (see image above).

Now in the field above we see text input field with grey string “9r279FZJm”. This is randomly generated string that was assigned as field’s name for our image field. In exported data we most probably want to have more human readable field.

step02.png

So we simply enter string “number” for this field.

step03.png

We do the same with text field and name it “text”.

step04.png

Next step is to get CSV file. CSV is acronym for Comma Separated Values and is simply text file with your data separated using commas. You can open this file with any spreadsheet software (like MS Excel, Libre Calc and etc.).

step05.png

So here is how your data should look like. You should see following fields:

  • card_id - unique card id

  • card_count - how many units of this card do you need

  • number - this is filename for our image field. Remember that we have named our image field “number”. As well image field corresponds to import image filename.

  • number_global - “n” means that this image is taken from your uploaded images. “y” would mean that you are using image from Card-a-mon’s collection.

  • text - here is text from our text field.

step06.png

Now let’s create some cards. We can leave card_id field empty - it will be generated automatically during import. After we enter data we want to, we must save it as CSV file.

step07.png

Now you can import your CSV file. You can do this by drag-and-dropping file onto import field or by clicking “Browse” and importing file from your system.

step08.png

You should see all cards imported after this step.

Another option is to export your card set as JSON file. This file contains not only data about images and texts but all the information about cards: size, location in card and etc. The simplest case where this could be useful is to copy your card set to another game. E.g. if you want to translate your game to another language you can get card sets JSON file and import it into game translated in another language.

In next tutorial we will look at PDF generation options.

Lastly, if you have comments, suggestions and etc. do not hesitate and contact me by e-mail dalius.dobravolskas@gmail.com or any other way you find appropriate for you and me.