Best way to load array from external file?

Get help using Construct 2

Post » Wed Oct 21, 2015 9:47 pm

Hello,

I have a character that is saying a new line every few seconds.  I want to get all the lines into an array and loop through them simply:
-change text to array.at(x)
- add 1 to x
-wait

Working fine with the first few lines as I have added them to array on layout start.  But instead of adding all the lines on layout start I would prefer to load from an external file for two reasons:

1) So I can edit the lines without having to republish the project
2) To not use up a lot of command lines as I am using the free version currently (contemplating upgrade)

On a previous project I have used Ajax/Php/mySQL for a high scores table and could go that route but thought I could cut out a step using JSON or XML, which I am not as familiar with though.

Project will be uploaded so external file would be uploaded as well.

So if you were doing something similar how would you go about it?  If there are good examples please point me to the project files.

(please note, I prefer not to use plugins)

Thanks
ImageImageImage
B
44
S
26
G
11
Posts: 520
Reputation: 10,506

Post » Wed Oct 21, 2015 10:14 pm

These tutorials might help

https://www.scirra.com/tutorials/328/us ... onstruct-2

https://www.scirra.com/tutorials/807/ho ... -game-talk

also populating an array from json is a way..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Oct 22, 2015 1:15 am

Thanks LIttleStain! After downloading the zip file on the second link I think seeing that example I will be able to get it accomplished similar to his using xml.

If anyone else has any comments I'm all ears as I am always trying to learn but I think I'm set on this part.


LittleStain - I see your profile says you are a graphic designer and love to see your designs become interactive - you have any art I can play with? I'm just trying to make small projects right now to learn all the aspects of Construct and it sure would be more fun if it looked nice as opposed to using red and blue squares or any horrible art I made quickly. If you want to share anything I'll make a game inspired by the art.
ImageImageImage
B
44
S
26
G
11
Posts: 520
Reputation: 10,506


Return to How do I....?

Who is online

Users browsing this forum: Cipriux, Yahoo [Bot] and 33 guests