Button click to display data from Array 0-4

  • Every click will be a random word.

    I tried random, array.at(0) +1, myArray.CurValue +1, I can't seem to find the answer.

    I Also can't figure out how to call functions from my javascript. I dont see a html file to and scripts.

    I quess idiot.

    Also I'm making a big list of words.

    What is the best way to store that?

    Just type them out in the events individually?

  • Array.at(floor(random(array.width-1) will give you the value at a random position in the array.

    I recommend learning how to parse a text file to work with a large list of words. You can import the list as a project file, read it with AJAX, and parse out each word with tokenat and the newline expression as your token separator.

  • Heck yes it works. I tried to put the Math version in and it wouldn't go. Thank-you.

    I figured out my initial problem with call js........I didn't use quotes.

    What you said about the AJAX I will have to work on putting that together.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok I got basic AJAX working too. And It did read the first word in my text.txt file.

    More stuff to think about.

    Thanks again.

  • Cool, so in your text file, have each word on a newline.

    By using a loop, you can push tokenat(textfile,loopindex,newline) to an array, which will then populate your array for you. (Start with your array at width 0)

    You can use tokencount(textfile,newline) to see how many lines there are in your text file, which also gives you how many times to run your loop.

  • Do you think this is the way to do things. I want to present a word and then another button to spell it out 1 textbox for each letter. or I can use the token thing. What do you think?

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