How do I display a random word from file.txt

Just started using Construct 2? Post your questions here

Post » Sat Oct 31, 2015 5:36 pm

Hello,
I need to display a random word from a file.txt

I managed to display the first word from the file, taking expressions I found on the forum: tokenat(AJAX.LastData,loopindex,",")

thank for your attention,
B
3
Posts: 4
Reputation: 183

Post » Sat Oct 31, 2015 6:16 pm

If that gets the first word this will get a random one:
tokenat(AJAX.LastData,int(random(tokencount(AJAX.LastData,","))), ",")
B
92
S
32
G
107
Posts: 5,274
Reputation: 69,959

Post » Sat Oct 31, 2015 7:02 pm

It works perfectly :)
I don't understand it very well but that's awesome thanks.
B
3
Posts: 4
Reputation: 183


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest