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

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • With ajax you can read files and data from an external location.

  • 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?

  • If you use PHP, then add the header access control:

    i.e.

    <?php
    header('Access-Control-Allow-Origin: *'); 
    
    ..rest of your code ...
    ?>[/code:2oencyf8]
    
    Also, for your Ajax request, you can add the header: 
    
    Header: "Access-Control-Allow-Origin"
    Value: "*"
    
    This solves most of the cross domain issues.
  • 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.

    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.

  • Gary

    are you able to import other file types or just php?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)