ErudioLtd's Forum Posts

  • You can store array items in a json file (just rename with *.json instead of *.txt) in the following format:

    {

    "c2array":true,

    "size":[5,6,1],

    "data":

    [ > [[0],[1],[0],[-1],[-1], [0.5]],

    [[1],[0],[1],[0],[-1], [0.5]],

    [[0],[3],[1],[3],[-1], [0.5]],

    [[1],[3],[0],[3],[-1], [0.5]],

    [[2],[3],[2],[3],[-1], [0.5]],

    ]

    }

    You can make the data items what ever you want, of course.

    You can make the array as big as you like and even turn it into a 3D array by adding extra items within the inner square brackets, just make sure to adjust the size values at the top.

    Import the file into the files folder for your project on the "Project" tab.

    Add an array object to your game (e.g. yourArrayObject)

    Add the AJAX object.

    System|On start of layout: AJAX| Request (your json).json (tag "your tag")

    AJAX | On "your tag" completed: yourArrayObject|Load from JSON string AJAX.LastData

    This will grab your json array and add it to the array object - I don't think you have to stipulate the size of your array object - it should automatically fill up from the json - but it probably doesn't hurt to set the dimensions the same.

    Hope that makes sense!

    Thanks, this is great advice for anyone looking to use Arrays to do things like level editors and RNG based card games. Thanks a lot. (although i didn't need to use this as i realised i didn't need an array to do what i wanted and could just load in the things I wanted and use them as they are using AJAX.)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I want to be able to read 22 words out of a text file to set as variables to use in a card game.

    I have a set up that allows me to take a string that I have saved out to a text file (of 22 words) and separate them.

    is there a way to have a similar set up with and array and AJAX but store more than 9 things?

    Thanks,

    All advice appreciated.

  • is there a way to edit project files within the project?

    For context, I want to be able use in .txt files in the project to allow the user to save/load word sets in.

    To do this i want to use the ajax plugin to read project files and use the string contained in those files to fill some variables.

    Is there a way to tell the program to load in a text file to read from or does the .txt have to be a project file to be used with AJAX.

    tl;dr

    How can i allow the user to edit project files (.txt)?

    Thanks

    All advice appreciated

  • I am using a .txt in the projects files folder to set some variables (to act as a method to save sets of words).

    I am wondering if there is a way to edit/write to these files through the program (user creating sets of words).

    All help welcomed

    Thanks

  • How do i determine the sub folder? Just with a "\" ?

    Tried with an "&" but didn't change the path.

    Thanks

  • I want to use AJAX to load in some text from a .txt file.

    To do this i have added the txt to the files folder on construct 2.

    When the game is played (NWJS) how will this work?

    Do i have to create this .txt inside the games folder for it to read?

    Ant help greatly appreciated.

    Thanks.

  • I am writing to a .txt that i want to load back in into an array.

    I am aware that these have to be separated by semi colon which i can do but I'm pretty sure each entry needs to be separated by the line they are on.

    If this is the case, any way to force the text to be written with a space between each entry would be helpful.

    If this isn't the case and arrays can be filled with entries simply separated by semicolons.

    All advice welcomed, thanks.

  • I have created a game in which a folder is created using

    NWJs.Userfolder

    As to save to the player user folder. I have created a folder in this folder called saves but i'm not sure how to save a file into that folder.

    (this is not asking how to write to a external file just how i save to a subfolder within nwjs.userfolder.

    Thanks.

  • I am making a game in which i would like Text-To-Speech to read out some user inputted text.

    This is going to be an Nw.Js game so will use the Windows TTS engine to execute this. However, Anna (Win 7 voice) is American and I need the voice to be English (the game is education and so the words need to be pronounced properly).

    As far as i am aware there is no way to change windows voices which some pretty in-depth registry editing which I am not confident doing on a company computer.

    To get around this I am wondering if there is a way for construct 2 to use another TTS engine (like E-speak)?

    Thanks

    All advice welcomed and appreciated.

  • Nope. Just add it as an object.

  • On Start of Layout - > Local Storage - Check item exists "The name of your save file"

    If Exists -> Load "Save File name"

    If does exist -> Go to layout whatever

  • Hi

    I am making a card game in which you can create custom sets. Once you create these custom words, each is set as a variable and then used in the game.

    I would like to make the card set creator to be separate application, so the basic idea would be:

    • Make set in card set creator
    • Save set under a name
    • Then in the actual game, on load up game should be able to recognize if there is a saved set and add it to a list of choose-able sets.

    Does anyone know the best way to go about this?

    I think as i want the player to able to choose their own save name, I will have to create a saves folder in which the main application can search for files in?

    Any advice welcomed

    Thanks all

  • Thanks Buddies.

  • Should have thought of this myself.

    Thanks for the advice.

  • Hi all,

    I am looking to create a system by which on the first load of a game the user will be prompted the enter a serial key.

    I am aware of the basic principles of a serial key (Creating a code which is deciphered to equal a certain sum) however im not sure how to make the serial key prompt only appear on first launch.

    Any help greatly appreciated,

    Thanks