How do I Load Words from text file

0 favourites
  • 4 posts
From the Asset Store
Source code, art assets and music tracks to remake this game
  • hey,

    I am building a word game and i have almost set up all the functions and it works great now i want to add a function in which ajax should load only words which are having 4 letters and if there's a word beyond 4 letters it should skip that word.

    I went to forum but didn't got anything which can help all i could find was how to load the txt file










    So here ajax should load "Tree" and "Soup" and should skip rest

  • AJAX can't filter data, it will load the entire file. And you will need to find 4-letter words in AJAX data.

    How is your text file formatted?

    If it contains a list of words separated by the same symbol (comma, space, line break etc.), then it's easy.

    Use expressions Tokencount() to get the number of words, TokenAt() to retrieve each word, and Len() to check word length.

    For example - loop from 0 to Tokencount, compare each word length, if it's 4 letters, then add this word to an array.

    If the file has a different structure or contains some random text, it may be a bit more complicated.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • hey, dop2000

    Thanks for the reply i think the way game is set is different and more complicated do you mind taking a look to my capx if i forward you on PM

  • Sure.

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