tvoon's Recent Forum Activity

  • System: On start of layout -> AJAX: Request wordlist.txt (tag "LoadWordlist")

    AJAX: On "LoadWordlist" completed -> const textData = AJAX.LastData

    const words = textData.split(/\r?\n/);

    const validWordsDictionary =

    runtime.objects.ValidWordsDictionary.getFirstInstance();

    words.forEach(word => {

    if (word.length <= 7) {

    validWordsDictionary.add(word, true);

    }

    });

    Above is my code using c3 and part of it in JS. I've also created an AJAX object as well as a dictionary object named ValidWordsDictionary. The wordlist.txt is also included as a file within the project.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'd like to populate the dictionary from a list of about 19,000 words. The words are in a text file where each word is on a newline. I'd like to only store words with word length of seven or less in the dictionary.

    I've created both AJAX and dictionary objects in my project file along with the text file. AJAX appears to read only about 200 words then stops and I've zero entries in the dictionary.

  • Yes, the external file is read once when the game starts. I've tried AJAX to read the file into a variable with AJAX.LastData which was successful. The problem I'm having is to split the variable data into individual words and storing the words into a Construct array. I can't get Construct to do it either using its native built-in events or JS code blocks. Nothing seems to work. I'm missing something!

  • I have an external text file with all the words, each on a newline. The file contains all the words of a dictionary. I would like to read the contents of the file into my construct 3 project and store them into an array with each individual word stored as an element in the array.

tvoon's avatar

tvoon

Member since 20 Jan, 2024

None one is following tvoon yet!

Trophy Case

  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

3/44
How to earn trophies