Load large amounts of text data into an array

0 favourites
  • 10 posts
From the Asset Store
Data+ is the best Data Management solution for Construct 3. It contains 4 Addons (Plugin & Behavior).
  • Hi!

    I'm trying to create a dialogue system for my game and have decided to host all the text in an 2-dimensional array.

    I started filling this array with "set value at XY" -events and it became tedious quite quickly, which made me wonder if there is any way of populating this array more automatically.

    My goal is not to depend on any external files (like JSON-files). Is there some way of importing all this text to an array without the use of external files or tens of thousands of event sheet rows?

  • At some point the data has to be created. Probably best to create it externally then use a csv plugin or similar.

    ?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I understand that the data has to be created and that part I have already done with Chat Mapper. I can easily export the data from Chat Mapper to any kind of format that might help. But is there any such way I could format the data that I could simply paste it into Construct once and then loop trough it to populate the array? Instead of manually populating the array with actions.

    Now that I think of it... Would it be possible to separate the values with pipes | and copy them to Construct as a single string and then use tokenAt to loop trough the values in order to populate the array.. That seems like something worth trying! Is there any limitations to string lengths that might come into play here?

  • Did you look at the plugin? You can export your data to a csv file and import it into an array. I assumed from your original post that is what you wanted to do.

  • Hi! No, sorry, I should have mentioned I try to avoid all external dependencies, and that includes plugins. I'm currently working on separating the text with pipes and looping through it with getTokenAt. I will report back later how it went (please remind me if I forget).

    Things I've noticed so far:

    Large strings look really ugly in the event sheet, so It's best to put those into their own event sheets where you don't have to look at them much.

  • Hi! No, sorry, I should have mentioned I try to avoid all external dependencies, and that includes plugins. I'm currently working on separating the text with pipes and looping through it with getTokenAt. I will report back later how it went (please remind me if I forget).

    Things I've noticed so far:

    Large strings look really ugly in the event sheet, so It's best to put those into their own event sheets where you don't have to look at them much.

    Hey, did you figure out a good way to do this? I think Ashley has said before that you shouldn't put lots of text directly in the event sheet.

  • Just format it as JSON and load without an external plugin.

  • Hey neutrinox, did you make any progress using Chat Mapper output in your project? Looking for a dialogue design tool myself and this one seems to do all the right things..

  • I did array style text using event objects with text instance variables in my game and used AutoIt3 (Free) to help iterating over a text file and sending keystrokes. It is just a windows productivity tool that uses a BASIC like inline code structure. There is a bit of a learning curve but not much if you read their manual.

  • Hi! Sorry for the late reply! I ended up separating all my dialogue lines with pipes and made one event sheet just for this text. Then I simply created one global variable and pasted it all in. I'm later looping trough the sentences by using the pipe as the splitter and each line starts with a number so that I can easily call for the right position.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)