Load large amounts of text data into an array

Get help using Construct 2

Post » Fri Aug 01, 2014 9:54 pm

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?
B
9
S
1
Posts: 97
Reputation: 715

Post » Fri Aug 01, 2014 10:41 pm

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

plugin-csv-csv2array-csv2dictionary_t64326?
B
51
S
16
G
9
Posts: 1,098
Reputation: 11,252

Post » Fri Aug 01, 2014 10:50 pm

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?
B
9
S
1
Posts: 97
Reputation: 715

Post » Sat Aug 02, 2014 9:36 am

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.
B
51
S
16
G
9
Posts: 1,098
Reputation: 11,252

Post » Sat Aug 02, 2014 4:59 pm

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.
B
9
S
1
Posts: 97
Reputation: 715

Post » Sat Oct 11, 2014 11:07 pm

neutrinox wrote: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.
B
33
S
7
G
8
Posts: 312
Reputation: 8,528

Post » Sun Oct 12, 2014 1:25 am

Just format it as JSON and load without an external plugin.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Sun Nov 02, 2014 5:07 pm

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..
B
8
S
2
Posts: 28
Reputation: 546

Post » Mon Nov 03, 2014 4:43 am

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.
Image
B
36
S
14
G
11
Posts: 142
Reputation: 8,465

Post » Thu Jan 22, 2015 11:58 pm

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.
B
9
S
1
Posts: 97
Reputation: 715


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests