Documentation on text file importing. (ie. Maps, or lists)

flyfingers

  • Posts: 1
Hello all.

I have been searching around the Stencyl website and having trouble finding any information how to use the button found in the Maps or List attributes that lets you import from a text file. What should the structure look like for making said text file? I am trying to store Maps inside Maps to give myself a sort of database like the one demo'd on the Maps page in the stencylpedia. It shows it can be done but doesn't give any information how. It doesn't seem like it can be done in the UI attribute editor so I am assuming it would probably be easier in a text file to store the large amounts of data I want to store.

Fool

  • Posts: 88
I struggled with this myself at first.
Suppose you created a new file, called listfruits.txt

The contents would look like this:

Code: [Select]
apple
orange
bannana
watermelon


If you import that to a list attribute, stencyl will create one entry for each. The first would be apple.


For a hypothetical map attribute, called 'cars', you'd create a file called mapcars.txt (you can actually name the file however you want). Suppose you have only one map key 'cars', with a few entries. You'd have a single line in the text file
that looks like this:


Code: [Select]
cars= Mazda, Corvette, Hyundai

And if you imported the file into a map attribute, the attribute would have one key with a list of three values associated with it. Hope this helps.