How do I import an external string of data into a project.

Get help using Construct 2

Post » Sun May 07, 2017 2:35 am

I would like to make a table outside of game that can be used as a reference for my game at run time, this way I can just edit the external file and elements of my game will change without the users having to download a new update.

I also don't want the user to be prompted to download a file.

I've played around with backendless, firebase, and tried a few other things, but seems like not very many people are doing this so there aren't any good instructions out there.

even just importing a normal txt file is fine although a csv would be preferable.
B
25
S
16
G
26
Posts: 125
Reputation: 16,103

Post » Sun May 07, 2017 6:06 am

With ajax you can read files and data from an external location.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,567

Post » Sun May 07, 2017 7:21 am

I tried that, but it doesn't do anything.

I read something about ajax blocking cross domain requests, so im guessing that's at least part of the problem. Are there any cloud services that allow cross domain request or to I need to buy my own hosting and domain name?
B
25
S
16
G
26
Posts: 125
Reputation: 16,103

Post » Sun May 07, 2017 8:58 am

If you use PHP, then add the header access control:
i.e.

Code: Select all
<?php
header('Access-Control-Allow-Origin: *');

..rest of your code ...
?>



Also, for your Ajax request, you can add the header:

Header: "Access-Control-Allow-Origin"
Value: "*"


This solves most of the cross domain issues.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,567

Post » Sun May 07, 2017 4:35 pm

With backendless you can map your own domain name to your file storage and thus avoid any cross domain issues with loading the file. I do this in my app and it is working out great.

celstrider wrote:I would like to make a table outside of game that can be used as a reference for my game at run time, this way I can just edit the external file and elements of my game will change without the users having to download a new update.

I also don't want the user to be prompted to download a file.

I've played around with backendless, firebase, and tried a few other things, but seems like not very many people are doing this so there aren't any good instructions out there.

even just importing a normal txt file is fine although a csv would be preferable.
B
1
Posts: 1
Reputation: 127

Post » Sun May 07, 2017 6:01 pm

@gary

are you able to import other file types or just php?
B
25
S
16
G
26
Posts: 125
Reputation: 16,103


Return to How do I....?

Who is online

Users browsing this forum: atmas, engin20020, gamecorpstudio, rbailey83, tarek2 and 24 guests