Large .txt files

Discussion and feedback on Construct 2

Post » Sun Feb 02, 2014 8:53 am

Hello guys, big C2 fan here. Little help needed. I'm working on a My Collection type of app. Every item has like a 3 page description in a .txt file which I need to load when I click on item.
If I Use the Ajax request it prompts me to select .txt file manually from a list of project files which doesn't help.
The CSV table loads just fine and I tried storing item1.txt,item2.txt,...,itemN.txt then parse the table and load ".txt" value as a variable but I can't use said variable to load from URL
I guess I could paste the text for each item in the CSV table as a value, but multiple pages for each, more than a 100 items, separated by comas just doesn't seem right. And it would be a huge, unmanageable table in the editor, right?
So, how should I do this? I had the same issue with .jpg image files for the each item and I worked around it, as suggested, by loading them as animation frames but I just can't figure it out what to do for the texts.
Thanks a lot!
B
6
Posts: 10
Reputation: 295

Post » Sun Feb 02, 2014 10:07 am

Why do you need to select a txt file for your ajax action.

If you know the filename in the project files, just use a URL request like "item1.txt". Or if you dynamically want to go through all elements, you could use "item"&variablenumber&".txt" as filename and change the variablenumber each time.

I'm not sure where you are stuck, especially since you bring up csv.
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786

Post » Sun Feb 02, 2014 2:24 pm

If you're using Ajax my suggestion would be to just have a PHP script serve the text you want.
B
9
S
3
Posts: 37
Reputation: 749

Post » Sun Feb 02, 2014 2:42 pm

mindfaQ:
Thanks for reply. I can't find "load from URL" for .txt files. I only have that option when loading images. Also Ajax prompts me to a list of set project files to choose from manually. I want the user to be able to click on item and bring up the text description of item in new layout.

nusbaumc:

i have no idea what that is but i will look it up right now. Thank you!
Edit: It looks like PHP works with mysql and seems quite complicated for something like bringing up a text from a project file. Oh, and i dont know if it's relevant but my app needs to work offline.xum2014-02-02 15:00:28
B
6
Posts: 10
Reputation: 295

Post » Sun Feb 02, 2014 3:48 pm

I use php a lot, and it could easily do what you want (it is not just for mySql), although it does require a web server - so I guess that is not the way for you to go.

Keep reading through the manual - I am sure there is a fairly easy way to do it!

B
94
S
33
G
20
Posts: 438
Reputation: 17,615

Post » Sun Feb 02, 2014 4:50 pm

@xum - just use 'Request URL' instead of 'Request project file', and enter a filename based on an expression.
Scirra Founder
B
387
S
230
G
87
Posts: 24,248
Reputation: 192,238

Post » Sun Feb 02, 2014 6:39 pm

@Ashley
Thanks, that worked like a charm. And wow! Thanks for taking time to answer such a beginners question. I wish you all the best!
B
6
Posts: 10
Reputation: 295


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 4 guests