How to load string Arrays to AJAX ?

Get help using Construct 2

Post » Wed Jul 17, 2013 7:52 am

How can I load String arrays from the .txt file with AJAX? i've read a tutorial about Ajax but that tutorial only allow us to return one sentence.

I am trying to make every words in the sentence dynamic, that means i can change the words in the .txt easily to make new sentence.
B
5
S
1
Posts: 11
Reputation: 553

Post » Wed Jul 17, 2013 9:55 am

How do you wish to store your "String arrays" in the txt file ? as JSON ? 1 string per line ? with a separator like ";" or "," ?

Here is a simple capx I made for loading N words from a txt file during runtime. You can store the words as you prefer in the for loop.

Hope this helps !
Guizmus2013-07-17 10:15:22
B
17
S
8
G
4
Posts: 461
Reputation: 6,087

Post » Wed Jul 17, 2013 10:14 am

Oh my god thats exactly what i want by separating the text in the .txt file, learned new stuff today. Thanks Guizmus!
B
5
S
1
Posts: 11
Reputation: 553

Post » Wed Jul 17, 2013 10:16 am

No problem ;) If you need the "," for anything else, you can change it in the file with a ";", or any other separator, and change it in the events too (in the tokenAt function and tokenCount)
B
17
S
8
G
4
Posts: 461
Reputation: 6,087

Post » Wed Jul 17, 2013 10:19 am

Understood! thanks (:
B
5
S
1
Posts: 11
Reputation: 553


Return to How do I....?

Who is online

Users browsing this forum: ma9ic, randomly, SnipG, totoe, Voytek, wakd, Yahoo [Bot] and 12 guests